title: Making a connection with Socket.connect using timeout
body: <p>I'm making a java TCP connection using the Socket class.</p>
  
  <pre><code>Socket socket = new Socket();
  socket.connect(new InetSocketAddress(host,port),50);
  </code></pre>
  
  <p>I want this connection to be established fast or not being established at all, so I'm using 50 ms for the connection timeout.</p>
  
  <p>But if I measure the time in-between those calls, I get more than 50 ms: 125ms, even 200ms. To measure the time I'm using System.currentMillis(). I know the granularity of this method it's not very good, but +100ms discrepancy is just ridiculous.</p>
  
  <p>There is a problem with the connect method? It's 50 ms too little time for the timeout? I'm using java 1.7.0_03 with windows 7.</p>