doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
socket.has_ipv6 This constant contains a boolean value which indicates if IPv6 is supported on this platform.
python.library.socket#socket.has_ipv6
socket.HCI_FILTER socket.HCI_TIME_STAMP socket.HCI_DATA_DIR For use with BTPROTO_HCI. HCI_FILTER is not available for NetBSD or DragonFlyBSD. HCI_TIME_STAMP and HCI_DATA_DIR are not available for FreeBSD, NetBSD, or DragonFlyBSD.
python.library.socket#socket.HCI_DATA_DIR
socket.HCI_FILTER socket.HCI_TIME_STAMP socket.HCI_DATA_DIR For use with BTPROTO_HCI. HCI_FILTER is not available for NetBSD or DragonFlyBSD. HCI_TIME_STAMP and HCI_DATA_DIR are not available for FreeBSD, NetBSD, or DragonFlyBSD.
python.library.socket#socket.HCI_FILTER
socket.HCI_FILTER socket.HCI_TIME_STAMP socket.HCI_DATA_DIR For use with BTPROTO_HCI. HCI_FILTER is not available for NetBSD or DragonFlyBSD. HCI_TIME_STAMP and HCI_DATA_DIR are not available for FreeBSD, NetBSD, or DragonFlyBSD.
python.library.socket#socket.HCI_TIME_STAMP
exception socket.herror A subclass of OSError, this exception is raised for address-related errors, i.e. for functions that use h_errno in the POSIX C API, including gethostbyname_ex() and gethostbyaddr(). The accompanying value is a pair (h_errno, string) representing an error returned by a library call. h_errno is ...
python.library.socket#socket.herror
socket.htonl(x) Convert 32-bit positive integers from host to network byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 4-byte swap operation.
python.library.socket#socket.htonl
socket.htons(x) Convert 16-bit positive integers from host to network byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation. Deprecated since version 3.7: In case x does not fit in 16-bit unsigned integer, but does fit in ...
python.library.socket#socket.htons
socket.if_indextoname(if_index) Return a network interface name corresponding to an interface index number. OSError if no interface with the given index exists. Availability: Unix, Windows. New in version 3.3. Changed in version 3.8: Windows support was added. See also “Interface name” is a name as documented in...
python.library.socket#socket.if_indextoname
socket.if_nameindex() Return a list of network interface information (index int, name string) tuples. OSError if the system call fails. Availability: Unix, Windows. New in version 3.3. Changed in version 3.8: Windows support was added. Note On Windows network interfaces have different names in different contexts...
python.library.socket#socket.if_nameindex
socket.if_nametoindex(if_name) Return a network interface index number corresponding to an interface name. OSError if no interface with the given name exists. Availability: Unix, Windows. New in version 3.3. Changed in version 3.8: Windows support was added. See also “Interface name” is a name as documented in i...
python.library.socket#socket.if_nametoindex
socket.inet_aton(ip_string) Convert an IPv4 address from dotted-quad string format (for example, ‘123.45.67.89’) to 32-bit packed binary format, as a bytes object four characters in length. This is useful when conversing with a program that uses the standard C library and needs objects of type struct in_addr, which i...
python.library.socket#socket.inet_aton
socket.inet_ntoa(packed_ip) Convert a 32-bit packed IPv4 address (a bytes-like object four bytes in length) to its standard dotted-quad string representation (for example, ‘123.45.67.89’). This is useful when conversing with a program that uses the standard C library and needs objects of type struct in_addr, which is...
python.library.socket#socket.inet_ntoa
socket.inet_ntop(address_family, packed_ip) Convert a packed IP address (a bytes-like object of some number of bytes) to its standard, family-specific string representation (for example, '7.10.0.5' or '5aef:2b::8'). inet_ntop() is useful when a library or network protocol returns an object of type struct in_addr (sim...
python.library.socket#socket.inet_ntop
socket.inet_pton(address_family, ip_string) Convert an IP address from its family-specific string format to a packed, binary format. inet_pton() is useful when a library or network protocol calls for an object of type struct in_addr (similar to inet_aton()) or struct in6_addr. Supported values for address_family are ...
python.library.socket#socket.inet_pton
socket.AF_VSOCK socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID VMADDR* SO_VM* Constants for Linux host/guest communication. Availability: Linux >= 4.8. New in version 3.7.
python.library.socket#socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID
socket.ntohl(x) Convert 32-bit positive integers from network to host byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 4-byte swap operation.
python.library.socket#socket.ntohl
socket.ntohs(x) Convert 16-bit positive integers from network to host byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation. Deprecated since version 3.7: In case x does not fit in 16-bit unsigned integer, but does fit in ...
python.library.socket#socket.ntohs
socket.AF_CAN socket.PF_CAN SOL_CAN_* CAN_* Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.25. New in version 3.3.
python.library.socket#socket.PF_CAN
socket.AF_PACKET socket.PF_PACKET PACKET_* Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.2.
python.library.socket#socket.PF_PACKET
socket.AF_RDS socket.PF_RDS socket.SOL_RDS RDS_* Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.30. New in version 3.3.
python.library.socket#socket.PF_RDS
socket.recv_fds(sock, bufsize, maxfds[, flags]) Receive up to maxfds file descriptors from an AF_UNIX socket sock. Return (msg, list(fds), flags, addr). Consult recvmsg() for the documentation of these parameters. Availability: Unix supporting recvmsg() and SCM_RIGHTS mechanism. New in version 3.9. Note Any trunca...
python.library.socket#socket.recv_fds
socket.send_fds(sock, buffers, fds[, flags[, address]]) Send the list of file descriptors fds over an AF_UNIX socket sock. The fds parameter is a sequence of file descriptors. Consult sendmsg() for the documentation of these parameters. Availability: Unix supporting sendmsg() and SCM_RIGHTS mechanism. New in version...
python.library.socket#socket.send_fds
socket.setdefaulttimeout(timeout) Set the default timeout in seconds (float) for new socket objects. When the socket module is first imported, the default is None. See settimeout() for possible values and their respective meanings.
python.library.socket#socket.setdefaulttimeout
socket.sethostname(name) Set the machine’s hostname to name. This will raise an OSError if you don’t have enough rights. Raises an auditing event socket.sethostname with argument name. Availability: Unix. New in version 3.3.
python.library.socket#socket.sethostname
socket.SIO_RCVALL socket.SIO_KEEPALIVE_VALS socket.SIO_LOOPBACK_FAST_PATH RCVALL_* Constants for Windows’ WSAIoctl(). The constants are used as arguments to the ioctl() method of socket objects. Changed in version 3.6: SIO_LOOPBACK_FAST_PATH was added.
python.library.socket#socket.SIO_KEEPALIVE_VALS
socket.SIO_RCVALL socket.SIO_KEEPALIVE_VALS socket.SIO_LOOPBACK_FAST_PATH RCVALL_* Constants for Windows’ WSAIoctl(). The constants are used as arguments to the ioctl() method of socket objects. Changed in version 3.6: SIO_LOOPBACK_FAST_PATH was added.
python.library.socket#socket.SIO_LOOPBACK_FAST_PATH
socket.SIO_RCVALL socket.SIO_KEEPALIVE_VALS socket.SIO_LOOPBACK_FAST_PATH RCVALL_* Constants for Windows’ WSAIoctl(). The constants are used as arguments to the ioctl() method of socket objects. Changed in version 3.6: SIO_LOOPBACK_FAST_PATH was added.
python.library.socket#socket.SIO_RCVALL
socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None) Create a new socket using the given address family, socket type and protocol number. The address family should be AF_INET (the default), AF_INET6, AF_UNIX, AF_CAN, AF_PACKET, or AF_RDS. The socket type should be SOCK_STREAM (the default), SOCK_DGRA...
python.library.socket#socket.socket
socket.accept() Accept a connection. The socket must be bound to an address and listening for connections. The return value is a pair (conn, address) where conn is a new socket object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. ...
python.library.socket#socket.socket.accept
socket.bind(address) Bind the socket to address. The socket must not already be bound. (The format of address depends on the address family — see above.) Raises an auditing event socket.bind with arguments self, address.
python.library.socket#socket.socket.bind
socket.close() Mark the socket closed. The underlying system resource (e.g. a file descriptor) is also closed when all file objects from makefile() are closed. Once that happens, all future operations on the socket object will fail. The remote end will receive no more data (after queued data is flushed). Sockets are ...
python.library.socket#socket.socket.close
socket.connect(address) Connect to a remote socket at address. (The format of address depends on the address family — see above.) If the connection is interrupted by a signal, the method waits until the connection completes, or raise a socket.timeout on timeout, if the signal handler doesn’t raise an exception and th...
python.library.socket#socket.socket.connect
socket.connect_ex(address) Like connect(address), but return an error indicator instead of raising an exception for errors returned by the C-level connect() call (other problems, such as “host not found,” can still raise exceptions). The error indicator is 0 if the operation succeeded, otherwise the value of the errn...
python.library.socket#socket.socket.connect_ex
socket.detach() Put the socket object into closed state without actually closing the underlying file descriptor. The file descriptor is returned, and can be reused for other purposes. New in version 3.2.
python.library.socket#socket.socket.detach
socket.dup() Duplicate the socket. The newly created socket is non-inheritable. Changed in version 3.4: The socket is now non-inheritable.
python.library.socket#socket.socket.dup
socket.family The socket family.
python.library.socket#socket.socket.family
socket.fileno() Return the socket’s file descriptor (a small integer), or -1 on failure. This is useful with select.select(). Under Windows the small integer returned by this method cannot be used where a file descriptor can be used (such as os.fdopen()). Unix does not have this limitation.
python.library.socket#socket.socket.fileno
socket.getblocking() Return True if socket is in blocking mode, False if in non-blocking. This is equivalent to checking socket.gettimeout() == 0. New in version 3.7.
python.library.socket#socket.socket.getblocking
socket.getpeername() Return the remote address to which the socket is connected. This is useful to find out the port number of a remote IPv4/v6 socket, for instance. (The format of the address returned depends on the address family — see above.) On some systems this function is not supported.
python.library.socket#socket.socket.getpeername
socket.getsockname() Return the socket’s own address. This is useful to find out the port number of an IPv4/v6 socket, for instance. (The format of the address returned depends on the address family — see above.)
python.library.socket#socket.socket.getsockname
socket.getsockopt(level, optname[, buflen]) Return the value of the given socket option (see the Unix man page getsockopt(2)). The needed symbolic constants (SO_* etc.) are defined in this module. If buflen is absent, an integer option is assumed and its integer value is returned by the function. If buflen is present...
python.library.socket#socket.socket.getsockopt
socket.gettimeout() Return the timeout in seconds (float) associated with socket operations, or None if no timeout is set. This reflects the last call to setblocking() or settimeout().
python.library.socket#socket.socket.gettimeout
socket.get_inheritable() Get the inheritable flag of the socket’s file descriptor or socket’s handle: True if the socket can be inherited in child processes, False if it cannot. New in version 3.4.
python.library.socket#socket.socket.get_inheritable
socket.ioctl(control, option) Platform Windows The ioctl() method is a limited interface to the WSAIoctl system interface. Please refer to the Win32 documentation for more information. On other platforms, the generic fcntl.fcntl() and fcntl.ioctl() functions may be used; they accept a socket object as their first...
python.library.socket#socket.socket.ioctl
socket.listen([backlog]) Enable a server to accept connections. If backlog is specified, it must be at least 0 (if it is lower, it is set to 0); it specifies the number of unaccepted connections that the system will allow before refusing new connections. If not specified, a default reasonable value is chosen. Change...
python.library.socket#socket.socket.listen
socket.makefile(mode='r', buffering=None, *, encoding=None, errors=None, newline=None) Return a file object associated with the socket. The exact returned type depends on the arguments given to makefile(). These arguments are interpreted the same way as by the built-in open() function, except the only supported mode ...
python.library.socket#socket.socket.makefile
socket.proto The socket protocol.
python.library.socket#socket.socket.proto
socket.recv(bufsize[, flags]) Receive data from the socket. The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by bufsize. See the Unix manual page recv(2) for the meaning of the optional argument flags; it defaults to zero. Note For best...
python.library.socket#socket.socket.recv
socket.recvfrom(bufsize[, flags]) Receive data from the socket. The return value is a pair (bytes, address) where bytes is a bytes object representing the data received and address is the address of the socket sending the data. See the Unix manual page recv(2) for the meaning of the optional argument flags; it defaul...
python.library.socket#socket.socket.recvfrom
socket.recvfrom_into(buffer[, nbytes[, flags]]) Receive data from the socket, writing it into buffer instead of creating a new bytestring. The return value is a pair (nbytes, address) where nbytes is the number of bytes received and address is the address of the socket sending the data. See the Unix manual page recv(...
python.library.socket#socket.socket.recvfrom_into
socket.recvmsg(bufsize[, ancbufsize[, flags]]) Receive normal data (up to bufsize bytes) and ancillary data from the socket. The ancbufsize argument sets the size in bytes of the internal buffer used to receive the ancillary data; it defaults to 0, meaning that no ancillary data will be received. Appropriate buffer s...
python.library.socket#socket.socket.recvmsg
socket.recvmsg_into(buffers[, ancbufsize[, flags]]) Receive normal data and ancillary data from the socket, behaving as recvmsg() would, but scatter the non-ancillary data into a series of buffers instead of returning a new bytes object. The buffers argument must be an iterable of objects that export writable buffers...
python.library.socket#socket.socket.recvmsg_into
socket.recv_into(buffer[, nbytes[, flags]]) Receive up to nbytes bytes from the socket, storing the data into a buffer rather than creating a new bytestring. If nbytes is not specified (or 0), receive up to the size available in the given buffer. Returns the number of bytes received. See the Unix manual page recv(2) ...
python.library.socket#socket.socket.recv_into
socket.send(bytes[, flags]) Send data to the socket. The socket must be connected to a remote socket. The optional flags argument has the same meaning as for recv() above. Returns the number of bytes sent. Applications are responsible for checking that all data has been sent; if only some of the data was transmitted,...
python.library.socket#socket.socket.send
socket.sendall(bytes[, flags]) Send data to the socket. The socket must be connected to a remote socket. The optional flags argument has the same meaning as for recv() above. Unlike send(), this method continues to send data from bytes until either all data has been sent or an error occurs. None is returned on succes...
python.library.socket#socket.socket.sendall
socket.sendfile(file, offset=0, count=None) Send a file until EOF is reached by using high-performance os.sendfile and return the total number of bytes which were sent. file must be a regular file object opened in binary mode. If os.sendfile is not available (e.g. Windows) or file is not a regular file send() will be...
python.library.socket#socket.socket.sendfile
socket.sendmsg(buffers[, ancdata[, flags[, address]]]) Send normal and ancillary data to the socket, gathering the non-ancillary data from a series of buffers and concatenating it into a single message. The buffers argument specifies the non-ancillary data as an iterable of bytes-like objects (e.g. bytes objects); th...
python.library.socket#socket.socket.sendmsg
socket.sendmsg_afalg([msg, ]*, op[, iv[, assoclen[, flags]]]) Specialized version of sendmsg() for AF_ALG socket. Set mode, IV, AEAD associated data length and flags for AF_ALG socket. Availability: Linux >= 2.6.38. New in version 3.6.
python.library.socket#socket.socket.sendmsg_afalg
socket.sendto(bytes, address) socket.sendto(bytes, flags, address) Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by address. The optional flags argument has the same meaning as for recv() above. Return the number of bytes sent. (The format ...
python.library.socket#socket.socket.sendto
socket.setblocking(flag) Set blocking or non-blocking mode of the socket: if flag is false, the socket is set to non-blocking, else to blocking mode. This method is a shorthand for certain settimeout() calls: sock.setblocking(True) is equivalent to sock.settimeout(None) sock.setblocking(False) is equivalent to so...
python.library.socket#socket.socket.setblocking
socket.setsockopt(level, optname, value: int)
python.library.socket#socket.socket.setsockopt
socket.settimeout(value) Set a timeout on blocking socket operations. The value argument can be a nonnegative floating point number expressing seconds, or None. If a non-zero value is given, subsequent socket operations will raise a timeout exception if the timeout period value has elapsed before the operation has co...
python.library.socket#socket.socket.settimeout
socket.set_inheritable(inheritable) Set the inheritable flag of the socket’s file descriptor or socket’s handle. New in version 3.4.
python.library.socket#socket.socket.set_inheritable
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(). ...
python.library.socket#socket.socket.share
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.
python.library.socket#socket.socket.shutdown
socket.type The socket type.
python.library.socket#socket.socket.type
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 defa...
python.library.socket#socket.socketpair
socket.SocketType This is a Python type object that represents the socket object type. It is the same as type(socket(...)).
python.library.socket#socket.SocketType
socket.SOCK_CLOEXEC socket.SOCK_NONBLOCK These two constants, if defined, can be combined with the socket types and allow you to set some flags atomically (thus avoiding possible race conditions and the need for separate calls). See also Secure File Descriptor Handling for a more thorough explanation. Availabilit...
python.library.socket#socket.SOCK_CLOEXEC
socket.SOCK_STREAM socket.SOCK_DGRAM socket.SOCK_RAW socket.SOCK_RDM socket.SOCK_SEQPACKET These constants represent the socket types, used for the second argument to socket(). More constants may be available depending on the system. (Only SOCK_STREAM and SOCK_DGRAM appear to be generally useful.)
python.library.socket#socket.SOCK_DGRAM
socket.SOCK_CLOEXEC socket.SOCK_NONBLOCK These two constants, if defined, can be combined with the socket types and allow you to set some flags atomically (thus avoiding possible race conditions and the need for separate calls). See also Secure File Descriptor Handling for a more thorough explanation. Availabilit...
python.library.socket#socket.SOCK_NONBLOCK
socket.SOCK_STREAM socket.SOCK_DGRAM socket.SOCK_RAW socket.SOCK_RDM socket.SOCK_SEQPACKET These constants represent the socket types, used for the second argument to socket(). More constants may be available depending on the system. (Only SOCK_STREAM and SOCK_DGRAM appear to be generally useful.)
python.library.socket#socket.SOCK_RAW
socket.SOCK_STREAM socket.SOCK_DGRAM socket.SOCK_RAW socket.SOCK_RDM socket.SOCK_SEQPACKET These constants represent the socket types, used for the second argument to socket(). More constants may be available depending on the system. (Only SOCK_STREAM and SOCK_DGRAM appear to be generally useful.)
python.library.socket#socket.SOCK_RDM
socket.SOCK_STREAM socket.SOCK_DGRAM socket.SOCK_RAW socket.SOCK_RDM socket.SOCK_SEQPACKET These constants represent the socket types, used for the second argument to socket(). More constants may be available depending on the system. (Only SOCK_STREAM and SOCK_DGRAM appear to be generally useful.)
python.library.socket#socket.SOCK_SEQPACKET
socket.SOCK_STREAM socket.SOCK_DGRAM socket.SOCK_RAW socket.SOCK_RDM socket.SOCK_SEQPACKET These constants represent the socket types, used for the second argument to socket(). More constants may be available depending on the system. (Only SOCK_STREAM and SOCK_DGRAM appear to be generally useful.)
python.library.socket#socket.SOCK_STREAM
socket.AF_ALG socket.SOL_ALG ALG_* Constants for Linux Kernel cryptography. Availability: Linux >= 2.6.38. New in version 3.6.
python.library.socket#socket.SOL_ALG
socket.AF_RDS socket.PF_RDS socket.SOL_RDS RDS_* Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.30. New in version 3.3.
python.library.socket#socket.SOL_RDS
SO_* socket.SOMAXCONN MSG_* SOL_* SCM_* IPPROTO_* IPPORT_* INADDR_* IP_* IPV6_* EAI_* AI_* NI_* TCP_* Many constants of these forms, documented in the Unix documentation on sockets and/or the IP protocol, are also defined in the socket module. They are generally used in arguments to the sets...
python.library.socket#socket.SOMAXCONN
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....
python.library.socket#socket.timeout
socketserver — A framework for network servers Source code: Lib/socketserver.py The socketserver module simplifies the task of writing network servers. There are four basic concrete server classes: class socketserver.TCPServer(server_address, RequestHandlerClass, bind_and_activate=True) This uses the Internet TCP p...
python.library.socketserver
class socketserver.BaseRequestHandler This is the superclass of all request handler objects. It defines the interface, given below. A concrete request handler subclass must define a new handle() method, and can override any of the other methods. A new instance of the subclass is created for each request. setup() ...
python.library.socketserver#socketserver.BaseRequestHandler
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.
python.library.socketserver#socketserver.BaseRequestHandler.finish
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 p...
python.library.socketserver#socketserver.BaseRequestHandler.handle
setup() Called before the handle() method to perform any initialization actions required. The default implementation does nothing.
python.library.socketserver#socketserver.BaseRequestHandler.setup
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 RequestHandl...
python.library.socketserver#socketserver.BaseServer
address_family The family of protocols to which the server’s socket belongs. Common examples are socket.AF_INET and socket.AF_UNIX.
python.library.socketserver#socketserver.BaseServer.address_family
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.
python.library.socketserver#socketserver.BaseServer.allow_reuse_address
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.
python.library.socketserver#socketserver.BaseServer.fileno
finish_request(request, client_address) Actually processes the request by instantiating RequestHandlerClass and calling its handle() method.
python.library.socketserver#socketserver.BaseServer.finish_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.
python.library.socketserver#socketserver.BaseServer.get_request
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 error and continue handling further requests. Changed in version 3.6: Now only called for exceptions derived from the Ex...
python.library.socketserver#socketserver.BaseServer.handle_error
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 time...
python.library.socketserver#socketserver.BaseServer.handle_request
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...
python.library.socketserver#socketserver.BaseServer.handle_timeout
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.
python.library.socketserver#socketserver.BaseServer.process_request
RequestHandlerClass The user-provided request handler class; an instance of this class is created for each request.
python.library.socketserver#socketserver.BaseServer.RequestHandlerClass
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 v...
python.library.socketserver#socketserver.BaseServer.request_queue_size
server_activate() Called by the server’s constructor to activate the server. The default behavior for a TCP server just invokes listen() on the server’s socket. May be overridden.
python.library.socketserver#socketserver.BaseServer.server_activate
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 exam...
python.library.socketserver#socketserver.BaseServer.server_address
server_bind() Called by the server’s constructor to bind the socket to the desired address. May be overridden.
python.library.socketserver#socketserver.BaseServer.server_bind
server_close() Clean up the server. May be overridden.
python.library.socketserver#socketserver.BaseServer.server_close