Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2f2c8296
Kaydet (Commit)
2f2c8296
authored
Tem 29, 2015
tarafından
Robert Collins
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23254: Document how to close the TCPServer listening socket.
Patch from Martin Panter.
üst
62a23383
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
socketserver.rst
Doc/library/socketserver.rst
+11
-2
test_socketserver.py
Lib/test/test_socketserver.py
+2
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/socketserver.rst
Dosyayı görüntüle @
2f2c8296
...
@@ -39,9 +39,10 @@ Creating a server requires several steps. First, you must create a request
...
@@ -39,9 +39,10 @@ Creating a server requires several steps. First, you must create a request
handler class by subclassing the :class:`BaseRequestHandler` class and
handler class by subclassing the :class:`BaseRequestHandler` class and
overriding its :meth:`handle` method; this method will process incoming
overriding its :meth:`handle` method; this method will process incoming
requests. Second, you must instantiate one of the server classes, passing it
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
: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,
When inheriting from :class:`ThreadingMixIn` for threaded connection behavior,
you should explicitly declare how you want your threads to behave on an abrupt
you should explicitly declare how you want your threads to behave on an abrupt
...
@@ -170,6 +171,13 @@ Server Objects
...
@@ -170,6 +171,13 @@ Server Objects
.. versionadded:: 2.6
.. versionadded:: 2.6
.. method:: BaseServer.server_close()
Clean up the server. May be overridden.
.. versionadded:: 2.6
.. attribute:: BaseServer.address_family
.. attribute:: BaseServer.address_family
The family of protocols to which the server's socket belongs.
The family of protocols to which the server's socket belongs.
...
@@ -540,6 +548,7 @@ An example for the :class:`ThreadingMixIn` class::
...
@@ -540,6 +548,7 @@ An example for the :class:`ThreadingMixIn` class::
client(ip, port, "Hello World 3")
client(ip, port, "Hello World 3")
server.shutdown()
server.shutdown()
server.server_close()
The output of the example should look something like this::
The output of the example should look something like this::
...
...
Lib/test/test_socketserver.py
Dosyayı görüntüle @
2f2c8296
...
@@ -158,6 +158,8 @@ class SocketServerTest(unittest.TestCase):
...
@@ -158,6 +158,8 @@ class SocketServerTest(unittest.TestCase):
if
verbose
:
print
"waiting for server"
if
verbose
:
print
"waiting for server"
server
.
shutdown
()
server
.
shutdown
()
t
.
join
()
t
.
join
()
server
.
server_close
()
self
.
assertRaises
(
socket
.
error
,
server
.
socket
.
fileno
)
if
verbose
:
print
"done"
if
verbose
:
print
"done"
def
stream_examine
(
self
,
proto
,
addr
):
def
stream_examine
(
self
,
proto
,
addr
):
...
...
Misc/NEWS
Dosyayı görüntüle @
2f2c8296
...
@@ -34,6 +34,9 @@ Core and Builtins
...
@@ -34,6 +34,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #23254: Document how to close the TCPServer listening socket.
Patch from Martin Panter.
- Issue #17527: Add PATCH to wsgiref.validator. Patch from Luca Sbardella.
- Issue #17527: Add PATCH to wsgiref.validator. Patch from Luca Sbardella.
- Issue #24613: Calling array.fromstring() with self is no longer allowed
- Issue #24613: Calling array.fromstring() with self is no longer allowed
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment