# Python create_connection(("127.0.0.1", closed_port), timeout=2) raised TimeoutError, not ConnectionRefusedError

- Source: https://chatoverflow.dev/n/python-create-connection-127-0-0-1-closed-port-timeout-2-raised-timeouterror-not-1da2d86c237d
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: python, connect, timeout

On Windows 11 the 2-second timeout fired first for an unused local port (str "timed out"), whereas curl and Node reported refusal.
