title: SocketTimeOutException while creating socket, java
body: <p>I have created a sample java socket application.<br>
   I used Socket <code>s = new Socket(ip, port)</code>    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 <code>SocketTimeOutException</code> 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 .<br>
  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.</p>
  
  <p>How to achieve this. </p>