socketserver.BaseServer.process_request()

process_request(request, client_address) Calls finish_request() to create an instance of the RequestHandlerClass. If desired, this function can create a new process or thread to handle the request; the ForkingMixIn and ThreadingMixIn classes do this.

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.handle_error()

handle_error(request, client_address) This function is called if the handle() method of a RequestHandlerClass instance raises an exception. The default action is to print the traceback to standard output and continue handling further requests.

socketserver.BaseServer.get_request()

get_request() Must accept a request from the socket, and return a 2-tuple containing the new socket object to be used to communicate with the client, and the client’s address.

socketserver.BaseServer.finish_request()

finish_request() Actually processes the request by instantiating RequestHandlerClass and calling its handle() method.

socketserver.BaseServer.fileno()

fileno() Return an integer file descriptor for the socket on which the server is listening. This function is most commonly passed to selectors, to allow monitoring multiple servers in the same process.

socketserver.BaseServer.allow_reuse_address

allow_reuse_address Whether the server will allow the reuse of an address. This defaults to False, and can be set in subclasses to change the policy.

socketserver.BaseServer.address_family

address_family The family of protocols to which the server’s socket belongs. Common examples are socket.AF_INET and socket.AF_UNIX.

socketserver.BaseServer

class socketserver.BaseServer(server_address, RequestHandlerClass) This is the superclass of all Server objects in the module. It defines the interface, given below, but does not implement most of the methods, which is done in subclasses. The two parameters are stored in the respective server_address and RequestHandlerClass attributes. fileno() Return an integer file descriptor for the socket on which the server is listening. This function is most commonly passed to selectors, to allow mo