diff options
Diffstat (limited to 'Doc/library/socketserver.rst')
-rw-r--r-- | Doc/library/socketserver.rst | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst index c900ea7..2c85c86 100644 --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -44,7 +44,7 @@ to behave autonomously; the default is :const:`False`, meaning that Python will not exit until all threads created by :class:`ThreadingMixIn` have exited. Server classes have the same external methods and attributes, no matter what -network protocol they use: +network protocol they use. Server Creation Notes @@ -193,6 +193,13 @@ The server classes support the following class variables: The type of socket used by the server; :const:`socket.SOCK_STREAM` and :const:`socket.SOCK_DGRAM` are two possible values. +.. data:: timeout + + Timeout duration, measured in seconds, or :const:`None` if no timeout is desired. + If no incoming requests are received within the timeout period, + the :meth:`handle_timeout` method is called and then the server resumes waiting for + requests. + There are various server methods that can be overridden by subclasses of base server classes like :class:`TCPServer`; these methods aren't useful to external users of the server object. @@ -220,6 +227,13 @@ users of the server object. method raises an exception. The default action is to print the traceback to standard output and continue handling further requests. +.. function:: handle_timeout() + + This function is called when the :attr:`timeout` attribute has been set to a + value other than :const:`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. .. function:: process_request(request, client_address) |