Accepting a socket on Windows 7 takes more than a second

Posted by eburger on Stack Overflow See other posts from Stack Overflow or by eburger
Published on 2009-12-30T18:49:37Z Indexed on 2010/06/10 6:12 UTC
Read the original article Hit count: 175

Filed under:
|

Here's what I've done:

  • I wrote a minimal web server (using Qt, but I don't think it's relevant here).
  • I'm running it on a legal Windows 7 32-bit.

The problem:

  • If I make a request with Firefox, IE, Chrome or Safari it takes takes about one second before my server sees that there is a new connection to be accepted.

Clues:

  • Using other clients (wget, own test client that just opens a socket) than Firefox, IE, Chrome, Safari seeing the new connection is matter of milliseconds.
  • I installed Apache and tried the clients mentioned above. Serving the request takes ~50ms as expected.
  • The problem isn't reproducible when running Windows XP (or compiling and running the same code under Linux)
  • The problem seems to present itself only when connecting to localhost. A friend connected over the Internet and serving the connection was a matter of milliseconds.
  • Running the server in different ports has no effect on the 1 second latency

Here's what I've tried without luck:

  • Stopped the Windows Defender service
  • Stopped the Windows Firewall service

Any ideas? Is this some clever 'security feature' in Windows 7? Why isn't Apache affected? Why are only the browsers affected?

© Stack Overflow or respective owner

Related posts about sockets

Related posts about windows-7