Classes | |
class | BlockingResolver |
class | ExecutorResolver |
class | OverrideResolver |
class | Resolver |
class | ThreadedResolver |
Functions | |
def | add_accept_handler |
def | bind_sockets |
def | bind_unix_socket |
def | is_valid_ip |
def | ssl_options_to_context |
def | ssl_wrap_socket |
Variables | |
int | _DEFAULT_BACKLOG = 128 |
tuple | _ERRNO_WOULDBLOCK = (errno.EWOULDBLOCK, errno.EAGAIN) |
tuple | _SSL_CONTEXT_KEYWORDS |
ssl = None | |
ssl_match_hostname = ssl.match_hostname | |
SSLCertificateError = ssl.CertificateError | |
xrange = range |
def tornado.netutil.add_accept_handler | ( | sock, | |
callback, | |||
io_loop = None |
|||
) |
Adds an `.IOLoop` event handler to accept new connections on ``sock``. When a connection is accepted, ``callback(connection, address)`` will be run (``connection`` is a socket object, and ``address`` is the address of the other end of the connection). Note that this signature is different from the ``callback(fd, events)`` signature used for `.IOLoop` handlers.
Definition at line 182 of file netutil.py.
def tornado.netutil.bind_sockets | ( | port, | |
address = None , |
|||
family = socket.AF_UNSPEC , |
|||
backlog = _DEFAULT_BACKLOG , |
|||
flags = None |
|||
) |
Creates listening sockets bound to the given port and address. Returns a list of socket objects (multiple sockets are returned if the given address maps to multiple IP addresses, which is most common for mixed IPv4 and IPv6 use). Address may be either an IP address or hostname. If it's a hostname, the server will listen on all IP addresses associated with the name. Address may be an empty string or None to listen on all available interfaces. Family may be set to either `socket.AF_INET` or `socket.AF_INET6` to restrict to IPv4 or IPv6 addresses, otherwise both will be used if available. The ``backlog`` argument has the same meaning as for `socket.listen() <socket.socket.listen>`. ``flags`` is a bitmask of AI_* flags to `~socket.getaddrinfo`, like ``socket.AI_PASSIVE | socket.AI_NUMERICHOST``.
Definition at line 71 of file netutil.py.
def tornado.netutil.bind_unix_socket | ( | file, | |
mode = 0o600 , |
|||
backlog = _DEFAULT_BACKLOG |
|||
) |
Creates a listening unix socket. If a socket with the given name already exists, it will be deleted. If any other file with that name exists, an exception will be raised. Returns a socket object (not a list of socket objects like `bind_sockets`)
Definition at line 152 of file netutil.py.
def tornado.netutil.is_valid_ip | ( | ip | ) |
Returns true if the given string is a well-formed IP address. Supports IPv4 and IPv6.
Definition at line 224 of file netutil.py.
def tornado.netutil.ssl_options_to_context | ( | ssl_options | ) |
Try to convert an ``ssl_options`` dictionary to an `~ssl.SSLContext` object. The ``ssl_options`` dictionary contains keywords to be passed to `ssl.wrap_socket`. In Python 3.2+, `ssl.SSLContext` objects can be used instead. This function converts the dict form to its `~ssl.SSLContext` equivalent, and may be used when a component which accepts both forms needs to upgrade to the `~ssl.SSLContext` version to use features like SNI or NPN.
Definition at line 411 of file netutil.py.
def tornado.netutil.ssl_wrap_socket | ( | socket, | |
ssl_options, | |||
server_hostname = None , |
|||
kwargs | |||
) |
Returns an ``ssl.SSLSocket`` wrapping the given socket. ``ssl_options`` may be either a dictionary (as accepted by `ssl_options_to_context`) or an `ssl.SSLContext` object. Additional keyword arguments are passed to ``wrap_socket`` (either the `~ssl.SSLContext` method or the `ssl` module function as appropriate).
Definition at line 444 of file netutil.py.
int tornado::netutil::_DEFAULT_BACKLOG = 128 |
Definition at line 69 of file netutil.py.
tuple tornado::netutil::_ERRNO_WOULDBLOCK = (errno.EWOULDBLOCK, errno.EAGAIN) |
Definition at line 63 of file netutil.py.
00001 frozenset(['ssl_version', 'certfile', 'keyfile', 00002 'cert_reqs', 'ca_certs', 'ciphers'])
Definition at line 407 of file netutil.py.
tornado::netutil::ssl = None |
Definition at line 36 of file netutil.py.
tornado::netutil::ssl_match_hostname = ssl.match_hostname |
Definition at line 44 of file netutil.py.
tornado::netutil::SSLCertificateError = ssl.CertificateError |
Definition at line 45 of file netutil.py.
tornado::netutil::xrange = range |
Definition at line 41 of file netutil.py.