[Python-Dev] socket.create_connection slow

"Martin v. Löwis" martin at v.loewis.de
Wed Jan 14 21:31:04 CET 2009


> I have no idea why the connect refusal takes so long.
> Maybe it's a vista thing?

I've looked into this further. It doesn't just happen for
localhost, but also for remote hosts, and not just for IPv6,
but also for IPv4, and not just for Vista, but also for XP.

The problem is this:
1. Vista sends SYN to target machine (say, through v6)
2. Target machine has no port open, and responds with
   RST,ACK
3. Vista waits 0.5s
4. Vista sends another SYN to target machine
5. Target machine responds with another RST,ACK
6. Vista waits another 0.5s
7. Vista retries a third time, again getting no connection
8. Vista gives up, having spend 1s in trying to establish
   a connection to a remote port where the remote system
   has confirmed that the connection is refused already
   a second ago.

I have not found documentation for this feature of the
Windows TCP stack, yet. There is the TcpMaxConnectRetransmissions
parameter, but this supposed affects requests without responses
(and supposed also starts of with 3s)

Regards,
Martin


More information about the Python-Dev mailing list