I am trying to accomplish the following tasks:
- Connect to an existing server using the Android app as a client.
- Keep the connection alive sending and receiving yada yada, the normal keep-alive session.
- (Difficult part) I need to (as close to real-time as possible) detect a socket break on the client side.
Should I use the Apache net package or Java net package? Any other hints on how to accomplish #3 is also appreciated. Which package offers the best performance/usability for use in Android applications?
For a project I made once (Android app and Java server), I used the very powerful Netty framework. It enabled me to implement a protocol once and share the code between the server and the app.
It may be a bit overkill depending on your needs, but it allows for very efficient and scalable network applications.