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
8a7e5daa
Kaydet (Commit)
8a7e5daa
authored
Ock 02, 2011
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix code indentation.
üst
d8f37ad1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
ssl.rst
Doc/library/ssl.rst
+18
-18
No files found.
Doc/library/ssl.rst
Dosyayı görüntüle @
8a7e5daa
...
@@ -768,11 +768,11 @@ To test for the presence of SSL support in a Python installation, user code
...
@@ -768,11 +768,11 @@ To test for the presence of SSL support in a Python installation, user code
should use the following idiom::
should use the following idiom::
try:
try:
import ssl
import ssl
except ImportError:
except ImportError:
pass
pass
else:
else:
[ do something that requires SSL support ]
... # do something that requires SSL support
Client-side operation
Client-side operation
^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^
...
@@ -883,26 +883,26 @@ new socket from the other end, and use the context's :meth:`SSLContext.wrap_sock
...
@@ -883,26 +883,26 @@ new socket from the other end, and use the context's :meth:`SSLContext.wrap_sock
method to create a server-side SSL socket for the connection::
method to create a server-side SSL socket for the connection::
while True:
while True:
newsocket, fromaddr = bindsocket.accept()
newsocket, fromaddr = bindsocket.accept()
connstream = context.wrap_socket(newsocket, server_side=True)
connstream = context.wrap_socket(newsocket, server_side=True)
try:
try:
deal_with_client(connstream)
deal_with_client(connstream)
finally:
finally:
connstream.close()
connstream.close()
Then you'll read data from the ``connstream`` and do something with it till you
Then you'll read data from the ``connstream`` and do something with it till you
are finished with the client (or the client is finished with you)::
are finished with the client (or the client is finished with you)::
def deal_with_client(connstream):
def deal_with_client(connstream):
data = connstream.recv(1024)
data = connstream.recv(1024)
# empty data means the client is finished with us
# empty data means the client is finished with us
while data:
while data:
if not do_something(connstream, data):
if not do_something(connstream, data):
# we'll assume do_something returns False
# we'll assume do_something returns False
# when we're finished with client
# when we're finished with client
break
break
data = connstream.recv(1024)
data = connstream.recv(1024)
# finished with client
# finished with client
And go back to listening for new client connections (of course, a real server
And go back to listening for new client connections (of course, a real server
would probably handle each client connection in a separate thread, or put
would probably handle each client connection in a separate thread, or put
...
...
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