SocketTimeOutException while creating socket, java

Posted by Sunil Kumar Sahoo on Stack Overflow See other posts from Stack Overflow or by Sunil Kumar Sahoo
Published on 2010-04-01T08:08:53Z Indexed on 2010/04/01 8:13 UTC
Read the original article Hit count: 364

Filed under:
|
|

Hi All, I have created a sample java socket application. I used Socket s = new Socket(ip, port) Now it works fine. but when my internet connection is very slow that time after a long interval (even if sometimes after 2 minutes) i used to get SocketTimeOutException in that line. means it gives that error while creating socket. I want the exception should be handled properly means if internet connection is very slow then if that error occurs it happens very late now . I want if this type of error occurs then it should be caught very fast means the error should not come at such a delay interval of time rather it should come immediately.

How to achieve this.

Thanks Sunil Kumar Sahoo

© Stack Overflow or respective owner

Related posts about java

Related posts about socket