aspose file tools*
The moose likes Android and the fly likes File transfer using socket communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "File transfer using socket communication" Watch "File transfer using socket communication" New topic
Author

File transfer using socket communication

Asif Kadiwala
Greenhorn

Joined: Jun 10, 2008
Posts: 17
Can we create two way socket communication for file transfer?? Means Transferring files from Desktop PC to Android device and vice versa. And Is it possible to store the files in the device other than SD card???
Mark L. Murphy
Author
Ranch Hand

Joined: Feb 11, 2009
Posts: 131
Can we create two way socket communication for file transfer?? Means Transferring files from Desktop PC to Android device and vice versa.


Network sockets, yes. Android supports standard Java sockets, so anything that uses those has a decent shot of working.

And Is it possible to store the files in the device other than SD card???


Yes, but depending upon the device, there may be very little storage on the device itself. In the case of the T-Mobile G1, we're talking 70MB total. Other devices may have substantially more, of course.

Mark Murphy (a Commons Guy)
Author of The Busy Coder's Guide to Android Development http://commonsware.com/Android/
Asif Kadiwala
Greenhorn

Joined: Jun 10, 2008
Posts: 17
Hi Mark,

Thanks for your reply. Is it possible to store files received using socket communication from desktop to the emulator other than SD card?? How much memory emulator has??

For the socket communication, is there any API available to send files??
Mark L. Murphy
Author
Ranch Hand

Joined: Feb 11, 2009
Posts: 131
Is it possible to store files received using socket communication from desktop to the emulator other than SD card??


Yes. Each application has its own private file storage area.

How much memory emulator has??


Honestly, I do not know.

For the socket communication, is there any API available to send files??


There are two HTTP APIs in Android (URLConnection and Apache HttpClient). HttpClient definitely supports PUT and POST operations for sending files.
Derek Cram
Greenhorn

Joined: Mar 08, 2009
Posts: 5
You can do HTTP and FTP communication. However, as far as I know you cannot have incoming socket to Android device. For FTP it means that you cannot use Active mode.
Only passive mode can work. We've a FTP client that will show that socket communication works: http://www.lysesoft.com/products/andftp/index.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File transfer using socket communication