gevent._socket2
– Python 2 socket module¶socket
(family=2, type=2, proto=0, _sock=None)[source]¶Bases: object
gevent socket.socket for Python 2.
This object should have the same API as the standard library socket linked to above. Not all methods are specifically documented here; when they are they may point out a difference to be aware of or may document a method the standard library does not.
create_connection
(address, timeout=None, source_address=None) → socket[source]¶Connect to address and return the gevent.socket.socket
object.
Convenience function. Connect to address (a 2-tuple (host,
port)
) and return the socket object. Passing the optional
timeout parameter will set the timeout on the socket instance
before attempting to connect. If no timeout is supplied, the
global default timeout setting returned by
getdefaulttimeout()
is used. If source_address is set it
must be a tuple of (host, port) for the socket to bind as a source
address before making the connection. A host of ‘’ or port 0 tells
the OS to use the default.
getaddrinfo
(host, port, family=0, socktype=0, proto=0, flags=0)[source]¶Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string service name such as ‘http’, a numeric port number or None. By passing None as the value of host and port, you can pass NULL to the underlying C API.
The family, type and proto arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results.
See also
gethostbyname
(host) → address[source]¶Return the IP address (a string of the form ‘255.255.255.255’) for a host.
See also
gethostbyname_ex
(host) -> (name, aliaslist, addresslist)[source]¶Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number. Resolve host and port into list of address info entries.
See also
gethostbyaddr
(ip_address) -> (name, aliaslist, addresslist)[source]¶Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number.
See also
Next page: gevent.ssl
– Secure Sockets Layer (SSL/TLS) module