Public Member Functions | |
def | __init__ |
def | add_socket |
def | add_sockets |
def | bind |
def | handle_stream |
def | listen |
def | start |
def | stop |
Public Attributes | |
io_loop | |
ssl_options | |
Private Member Functions | |
def | _handle_connection |
Private Attributes | |
_pending_sockets | |
_sockets | |
_started |
Definition at line 38 of file netutil.py.
def tornado.netutil.TCPServer.__init__ | ( | self, | |
io_loop = None , |
|||
ssl_options = None |
|||
) |
Definition at line 88 of file netutil.py.
def tornado.netutil.TCPServer._handle_connection | ( | self, | |
connection, | |||
address | |||
) | [private] |
Definition at line 195 of file netutil.py.
def tornado.netutil.TCPServer.add_socket | ( | self, | |
socket | |||
) |
Singular version of `add_sockets`. Takes a single socket object.
Definition at line 123 of file netutil.py.
def tornado.netutil.TCPServer.add_sockets | ( | self, | |
sockets | |||
) |
Makes this server start accepting connections on the given sockets. The ``sockets`` parameter is a list of socket objects such as those returned by `bind_sockets`. `add_sockets` is typically used in combination with that method and `tornado.process.fork_processes` to provide greater control over the initialization of a multi-process server.
Definition at line 106 of file netutil.py.
def tornado.netutil.TCPServer.bind | ( | self, | |
port, | |||
address = None , |
|||
family = socket.AF_UNSPEC , |
|||
backlog = 128 |
|||
) |
Binds this server to the given port on the given address. To start the server, call `start`. If you want to run this server in a single process, you can call `listen` as a shortcut to the sequence of `bind` and `start` calls. 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`. This method may be called multiple times prior to `start` to listen on multiple ports or interfaces.
Definition at line 127 of file netutil.py.
def tornado.netutil.TCPServer.handle_stream | ( | self, | |
stream, | |||
address | |||
) |
Override to handle a new `IOStream` from an incoming connection.
Reimplemented in tornado.httpserver.HTTPServer.
Definition at line 191 of file netutil.py.
def tornado.netutil.TCPServer.listen | ( | self, | |
port, | |||
address = "" |
|||
) |
Starts accepting connections on the given port. This method may be called more than once to listen on multiple ports. `listen` takes effect immediately; it is not necessary to call `TCPServer.start` afterwards. It is, however, necessary to start the `IOLoop`.
Definition at line 95 of file netutil.py.
def tornado.netutil.TCPServer.start | ( | self, | |
num_processes = 1 |
|||
) |
Starts this server in the IOLoop. By default, we run the server in this process and do not fork any additional child process. If num_processes is ``None`` or <= 0, we detect the number of cores available on this machine and fork that number of child processes. If num_processes is given and > 1, we fork that specific number of sub-processes. Since we use processes and not threads, there is no shared memory between any server code. Note that multiple processes are not compatible with the autoreload module (or the ``debug=True`` option to `tornado.web.Application`). When using multiple processes, no IOLoops can be created or referenced until after the call to ``TCPServer.start(n)``.
Definition at line 154 of file netutil.py.
def tornado.netutil.TCPServer.stop | ( | self | ) |
Stops listening for new connections. Requests currently in progress may still continue after the server is stopped.
Definition at line 181 of file netutil.py.
Definition at line 88 of file netutil.py.
tornado::netutil.TCPServer::_sockets [private] |
Definition at line 88 of file netutil.py.
tornado::netutil.TCPServer::_started [private] |
Definition at line 88 of file netutil.py.
Definition at line 88 of file netutil.py.
Definition at line 88 of file netutil.py.