Matt and Neil
Matt and Neil

Reputation: 157

Google Chrome Packaged App - FTP mechanism

I'm looking to perform a simple FTP RETR of an image at a known server location from within a Google Chrome Packaged App. I'm exploring the following avenues:

  1. XMLHttpRequest (which throws Exception 101: cross domain only allowed for HTTP)

  2. TCP chrome.socket.write (sends packets OK, but no way to receive TCP data? Edit: wrong)

  3. WebSockets (which throws Exception 18: WebSocket port 21 blocked)

  4. <webview> (pulls the data alright in a sandboxed process, with no way to intercept it)

I've tried considering other possible approaches (my device runs a telnet server on port 23) but I don't think there are any shortcuts here.

Could my Chrome App possibly capture the webview's pixeldata in an HTML5 Canvas?

Have I overlooked any other communications mechanisms? All guidance appreciated.

Edit: apsillers/sowbug's comment per chrome.socket.read has reopened avenue #2. Woops! Using this on the port per the PASV response allowed me to perform a stream and retrieve the image data - thanks.

If it helps anyone else, here's the beginnings of a socket object and ftp client which run in an extension/app.

Usage: new Ftp('192.168.1.1', 21).retrieve('/path/to/file.ext', eofHandler);

Upvotes: 1

Views: 619

Answers (1)

sowbug
sowbug

Reputation: 4672

chrome.socket.read() should do nicely.

Upvotes: 1

Related Questions