socketserver.BaseServer.RequestHandlerClass

RequestHandlerClass The user-provided request handler class; an instance of this class is created for each request.

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

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

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.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.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.BaseRequestHandler.finish()

finish() Called after the handle() method to perform any clean-up actions required. The default implementation does nothing. If setup() raises an exception, this function will not be called.