summaryrefslogtreecommitdiffstats
path: root/Doc/library/socketserver.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/socketserver.rst')
-rw-r--r--Doc/library/socketserver.rst13
1 files changed, 11 insertions, 2 deletions
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index 9db36d5..18be936 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -33,9 +33,10 @@ Creating a server requires several steps. First, you must create a request
handler class by subclassing the :class:`BaseRequestHandler` class and
overriding its :meth:`handle` method; this method will process incoming
requests. Second, you must instantiate one of the server classes, passing it
-the server's address and the request handler class. Finally, call the
+the server's address and the request handler class. Then call the
:meth:`handle_request` or :meth:`serve_forever` method of the server object to
-process one or many requests.
+process one or many requests. Finally, call :meth:`~BaseServer.server_close`
+to close the socket.
When inheriting from :class:`ThreadingMixIn` for threaded connection behavior,
you should explicitly declare how you want your threads to behave on an abrupt
@@ -177,6 +178,13 @@ Server Objects
Tell the :meth:`serve_forever` loop to stop and wait until it does.
+.. method:: BaseServer.server_close()
+
+ Clean up the server. May be overridden.
+
+ .. versionadded:: 2.6
+
+
.. attribute:: BaseServer.address_family
The family of protocols to which the server's socket belongs.
@@ -547,6 +555,7 @@ An example for the :class:`ThreadingMixIn` class::
client(ip, port, "Hello World 3")
server.shutdown()
+ server.server_close()
The output of the example should look something like this::