views:

177

answers:

0

Greetings all,

I am developing an app that communicates TCP/IP with a hardware controller(server). I have no problems connecting to the server through my ConnectionService(), sending/receiving messages (correct IP and Port) when I call for a new Socket(). However, when I enter a wrong IP or Port the app should present the user with a dialog indicating a connection failure. I am having trouble implementing this function because of the following:

Essentially I am starting a ConnectionService() which instanciates a Connection() from my Splash Screen Activity. I have extensively tried different combinations of threading and try/catch combinations.

The thing that I find most odd is that even if I move the command to start the service to a thread, when that thread reaches the new Socket() command in my Connection class.. it locks up the UI thread. ( it makes my Connecting... progress dialog stop spinning)

It seems like the exceptions associated with the Socket() take longer to be thrown that what Android will allow.

Any information on this subject would be greatly appreciated.

Thanks, J