socketserver.BaseServer.shutdown()

shutdown() Tell the serve_forever() loop to stop and wait until it does.

socketserver.BaseServer.serve_forever()

serve_forever(poll_interval=0.5) Handle requests until an explicit shutdown() request. Poll for shutdown every poll_interval seconds. Ignores the timeout attribute. It also calls service_actions(), which may be used by a subclass or mixin to provide actions specific to a given service. For example, the ForkingMixIn class uses service_actions() to clean up zombie child processes. Changed in version 3.3: Added service_actions call to the serve_forever method.

socketserver.BaseServer.server_close()

server_close() Clean up the server. May be overridden.

socketserver.BaseServer.socket

socket The socket object on which the server will listen for incoming requests.

socketserver.BaseServer.server_bind()

server_bind() Called by the server’s constructor to bind the socket to the desired address. May be overridden.

socketserver.BaseServer.service_actions()

service_actions() This is called in the serve_forever() loop. This method can be overridden by subclasses or mixin classes to perform actions specific to a given service, such as cleanup actions. New in version 3.3.

socketserver.BaseServer.handle_timeout()

handle_timeout() This function is called when the timeout attribute has been set to a value other than None and the timeout period has passed with no requests being received. The default action for forking servers is to collect the status of any child processes that have exited, while in threading servers this method does nothing.

socketserver.BaseServer.handle_request()

handle_request() Process a single request. This function calls the following methods in order: get_request(), verify_request(), and process_request(). If the user-provided handle() method of the handler class raises an exception, the server’s handle_error() method will be called. If no request is received within timeout seconds, handle_timeout() will be called and handle_request() will return.

socketserver.BaseServer.server_address

server_address The address on which the server is listening. The format of addresses varies depending on the protocol family; see the documentation for the socket module for details. For Internet protocols, this is a tuple containing a string giving the address, and an integer port number: ('127.0.0.1', 80), for example.

socketserver.BaseServer.request_queue_size

request_queue_size The size of the request queue. If it takes a long time to process a single request, any requests that arrive while the server is busy are placed into a queue, up to request_queue_size requests. Once the queue is full, further requests from clients will get a “Connection denied” error. The default value is usually 5, but this can be overridden by subclasses.