I am writing an app that connects to a telnet server via wifi. I have a service that manages the socket connection. It all works fine, but when the phone sleeps it disconn
Not sure as to the exact way to do this but I think the ConnectivityManager would be a good place to start.
http://developer.android.com/reference/android/net/ConnectivityManager.html
you can get an instance of this class by calling Context.getSystemService(Context.CONNECTIVITY_SERVICE)
There are also some other good classes in android.net that you can use.
Hope that helps.