ID EN
Socket

connect_ex

Python 3.11

Like connect(address), but return an error indicator instead of raising an exception for errors returned by the C-level connect() call (other problems, such as “host not found,” can still raise exceptions). The error indicator is 0 if the operation succeeded, otherwise the value of the errno variable. This is useful to support, for example, asynchronous connects.

Syntax

PYTHON
socket.connect_ex(address)

See Also

auditing event Availability