socketserver.BaseRequestHandler.setup()

setup() Called before the handle() method to perform any initialization actions required. The default implementation does nothing.

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

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.

socketserver.BaseRequestHandler.handle()

handle() This function must do all the work required to service a request. The default implementation does nothing. Several instance attributes are available to it; the request is available as self.request; the client address as self.client_address; and the server instance as self.server, in case it needs access to per-server information. The type of self.request is different for datagram or stream services. For stream services, self.request is a socket object; for datagram services, self.re

socket.timeout

exception socket.timeout A subclass of OSError, this exception is raised when a timeout occurs on a socket which has had timeouts enabled via a prior call to settimeout() (or implicitly through setdefaulttimeout()). The accompanying value is a string whose value is currently always “timed out”. Changed in version 3.3: This class was made a subclass of OSError.

socket.socket.shutdown()

socket.shutdown(how) Shut down one or both halves of the connection. If how is SHUT_RD, further receives are disallowed. If how is SHUT_WR, further sends are disallowed. If how is SHUT_RDWR, further sends and receives are disallowed.

socket.socketpair()

socket.socketpair([family[, type[, proto]]]) Build a pair of connected socket objects using the given address family, socket type, and protocol number. Address family, socket type, and protocol number are as for the socket() function above. The default family is AF_UNIX if defined on the platform; otherwise, the default is AF_INET. The newly created sockets are non-inheritable. Changed in version 3.2: The returned socket objects now support the whole socket API, rather than a subset. Chan

socket.SocketType

socket.SocketType This is a Python type object that represents the socket object type. It is the same as type(socket(...)).

socket.socket.type

socket.type The socket type.

socket.socket.share()

socket.share(process_id) Duplicate a socket and prepare it for sharing with a target process. The target process must be provided with process_id. The resulting bytes object can then be passed to the target process using some form of interprocess communication and the socket can be recreated there using fromshare(). Once this method has been called, it is safe to close the socket since the operating system has already duplicated it for the target process. Availability: Windows. New in versi