How to approach socket programming between C# -> Java (Android)

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-05-08T09:35:21Z Indexed on 2010/05/08 9:38 UTC
Read the original article Hit count: 138

Filed under:
|
|
|

I've recently knocked up a server/client app for Windows & Android that allows one to send a file from Windows to an android phone over a socket connection.

It works great for a single file but trying to send multiple files over in a single stream is causing me problems. I've also realised that aside from the binary data, I will need to send messages over the socket to indicate error states and other application messages. I have little experience with network programming and and wondering what is the best way forward.

Basically the C# server side of the app just goes into a listening state and uses Socket.SendFile to transmit the file. On Android I use the standard Java Socket.getInputStream() to receive the file. That works great for a single file transfer, but how should I handle multiple files and error/messaging information? Do I need to use a different socket for each file? Should I be using a higher level framework to handle this or can I send everything over the single socket? Any other suggestions for frameworks or learning materials?

© Stack Overflow or respective owner

Related posts about c#

Related posts about sockets