New submission from Steve Dower <steve.do...@python.org>:

When connecting to localhost, socket.connect() takes two seconds on Windows 
(the default) to time out, but on Linux (including WSL) it times out 
immediately.

Test code (assuming port 9999 has no listener):
>>> import socket
>>> socket.socket().connect(('localhost', 9999))

For a remote host, the timeout is approx 10s on Windows and 20s on WSL (I 
didn't test on a native Linux box).

I'm told the correct fix is to specify TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS 
[1] when connecting to localhost.

----------
components: Windows
messages: 373725
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: socket.connect() slow to time out on Windows
type: performance
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41308>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to