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 | |
max_buffer_size | |
read_chunk_size | |
ssl_options | |
Private Member Functions | |
def | _handle_connection |
Private Attributes | |
_pending_sockets | |
_sockets | |
_started |
Definition at line 38 of file tcpserver.py.
def tornado.tcpserver.TCPServer.__init__ | ( | self, | |
io_loop = None , |
|||
ssl_options = None , |
|||
max_buffer_size = None , |
|||
read_chunk_size = None |
|||
) |
Definition at line 90 of file tcpserver.py.
def tornado.tcpserver.TCPServer._handle_connection | ( | self, | |
connection, | |||
address | |||
) | [private] |
Definition at line 218 of file tcpserver.py.
def tornado.tcpserver.TCPServer.add_socket | ( | self, | |
socket | |||
) |
Singular version of `add_sockets`. Takes a single socket object.
Definition at line 145 of file tcpserver.py.
def tornado.tcpserver.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 `~tornado.netutil.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 128 of file tcpserver.py.
def tornado.tcpserver.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 <socket.socket.listen>`. This method may be called multiple times prior to `start` to listen on multiple ports or interfaces.
Definition at line 149 of file tcpserver.py.
def tornado.tcpserver.TCPServer.handle_stream | ( | self, | |
stream, | |||
address | |||
) |
Override to handle a new `.IOStream` from an incoming connection.
Reimplemented in tornado.test.concurrent_test.CapServer, tornado.httpserver.HTTPServer, and tornado.test.tcpclient_test.TestTCPServer.
Definition at line 214 of file tcpserver.py.
def tornado.tcpserver.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 117 of file tcpserver.py.
def tornado.tcpserver.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 ``autoreload=True`` option to `tornado.web.Application` which defaults to True when ``debug=True``). When using multiple processes, no IOLoops can be created or referenced until after the call to ``TCPServer.start(n)``.
Definition at line 176 of file tcpserver.py.
def tornado.tcpserver.TCPServer.stop | ( | self | ) |
Stops listening for new connections. Requests currently in progress may still continue after the server is stopped.
Reimplemented in tornado.test.tcpclient_test.TestTCPServer.
Definition at line 204 of file tcpserver.py.
Definition at line 90 of file tcpserver.py.
tornado::tcpserver.TCPServer::_sockets [private] |
Definition at line 90 of file tcpserver.py.
tornado::tcpserver.TCPServer::_started [private] |
Definition at line 90 of file tcpserver.py.
Definition at line 90 of file tcpserver.py.
Definition at line 90 of file tcpserver.py.
Definition at line 90 of file tcpserver.py.
Definition at line 90 of file tcpserver.py.