N Panigrahy N Panigrahy - 1 year ago 68
Android Question

how to create Socket connection in Android?

I have an application where i need to create socket connection. My requirement is, once my socket connection is established it need to be alive until i personally close it. Every 3 minutes i have to send data packets to the other end. Can anyone provide me some code sample with will help me to do this?

Answer Source

Here's another example for socket usage: Incorporating socket programming into your applications

You might want to make that a Service as well, so that the application doesn't need to be active all the time (see the wake-lock issue mentioned in Peter's answer)