title: "Connection refused" although server is listening
body: <p>I have a server listening on certain port on <code>127.0.0.1 and 18 local clients</code> who try to connect to it all the time concurrently. </p>
  
  <p><strong>After an hour or so of ongoing connections</strong>, one of the clients fails to connect (I use the C function connect() which returns -1 when fails) and <code>WSAGetLastError</code> returns <code>10061</code> which means "Connection refused". </p>
  
  <p>I read that one possible reason for this error to appear is server not listening on the correct port, but I print <code>netstat -an</code> command line output to a file at the same moment I try to connect and I can see that the server is listening on the correct port. </p>
  
  <p>Furthermore, when I try to reconnect or to connect from another application, I succeed.
  Do any of you know what might be the reason for the client to fail to connect even though the server is listening?</p>
  
  <p>BTW, I'm running on <code>Windows 7</code>.</p>