In the sample code, a SocketTimeoutException should be thrown if the connection can't be stablished in a second, isn't it?
try { s = new Socket(host, port); s.setSoTimeout(1000); if (s.isConnected()) s.close(); } catch (SocketTimeoutException e) { e.printStackTrace(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (ConnectException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } But the timeout take a looong time to be detected. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---