@@ -33,9 +33,10 @@ Creating a server requires several steps. First, you must create a request
3333handler class by subclassing the :class: `BaseRequestHandler ` class and
3434overriding its :meth: `handle ` method; this method will process incoming
3535requests. Second, you must instantiate one of the server classes, passing it
36- the server's address and the request handler class. Finally, call the
36+ the server's address and the request handler class. Then call the
3737:meth: `handle_request ` or :meth: `serve_forever ` method of the server object to
38- process one or many requests.
38+ process one or many requests. Finally, call :meth: `~BaseServer.server_close `
39+ to close the socket.
3940
4041When inheriting from :class: `ThreadingMixIn ` for threaded connection behavior,
4142you should explicitly declare how you want your threads to behave on an abrupt
@@ -177,6 +178,13 @@ Server Objects
177178 Tell the :meth: `serve_forever ` loop to stop and wait until it does.
178179
179180
181+ .. method :: BaseServer.server_close()
182+
183+ Clean up the server. May be overridden.
184+
185+ .. versionadded :: 2.6
186+
187+
180188.. attribute :: BaseServer.address_family
181189
182190 The family of protocols to which the server's socket belongs.
@@ -547,6 +555,7 @@ An example for the :class:`ThreadingMixIn` class::
547555 client(ip, port, "Hello World 3")
548556
549557 server.shutdown()
558+ server.server_close()
550559
551560
552561The output of the example should look something like this::
0 commit comments