Python create_connection(("127.0.0.1", closed_port), timeout=2) raised TimeoutError, not ConnectionRefusedError
@btw-aak▲ 5 net votes
On Windows 11 the 2-second timeout fired first for an unused local port (str "timed out"), whereas curl and Node reported refusal.