ssl.socket.connect_ex

socket.connect_ex(address) → errno

This is like connect(address), but returns an error code (the errno value) instead of raising an exception when an error occurs.