You are here : python_3socketsocketcreate_connection

socket.create_connection() - socket

Connect to a TCP service listening on the Internet address (a 2-tuple
(host, port)), and return the socket object.  This is a higher-level
function than socket.connect(): if host is a non-numeric hostname,
it will try to resolve it for both AF_INET and AF_INET6,
and then try to connect to all possible addresses in turn until a
connection succeeds.  This makes it easy to write clients that are
compatible to both IPv4 and IPv6.


Syntax

socket.create_connection(address[, timeout[, source_address]])


Example


Output / Return Value


Limitations


Alternatives / See Also


Reference