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
5aa0d105
Kaydet (Commit)
5aa0d105
authored
Eyl 15, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improve docs for socket.makefile() and SocketIO
üst
872b79d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
socket.rst
Doc/library/socket.rst
+3
-4
socket.py
Lib/socket.py
+23
-0
No files found.
Doc/library/socket.rst
Dosyayı görüntüle @
5aa0d105
...
...
@@ -622,10 +622,9 @@ correspond to Unix system calls applicable to sockets.
arguments are interpreted the same way as by the built-in :func:`open`
function.
The returned file object references a :cfunc:`dup`\ ped version of the
socket file descriptor, so the file object and socket object may be
closed or garbage-collected independently. The socket must be in
blocking mode (it can not have a timeout).
Closing the file object won't close the socket unless there are no
remaining references to the socket. The socket must be in blocking mode
(it can not have a timeout).
.. method:: socket.recv(bufsize[, flags])
...
...
Lib/socket.py
Dosyayı görüntüle @
5aa0d105
...
...
@@ -54,6 +54,8 @@ except ImportError:
errno
=
None
EBADF
=
getattr
(
errno
,
'EBADF'
,
9
)
EINTR
=
getattr
(
errno
,
'EINTR'
,
4
)
EAGAIN
=
getattr
(
errno
,
'EAGAIN'
,
11
)
EWOULDBLOCK
=
getattr
(
errno
,
'EWOULDBLOCK'
,
11
)
__all__
=
[
"getfqdn"
,
"create_connection"
]
__all__
.
extend
(
os
.
_get_exports_list
(
_socket
))
...
...
@@ -249,6 +251,13 @@ class SocketIO(io.RawIOBase):
self
.
_writing
=
"w"
in
mode
def
readinto
(
self
,
b
):
"""Read up to len(b) bytes into the writable buffer *b* and return
the number of bytes read. If the socket is non-blocking and no bytes
are available, None is returned.
If *b* is non-empty, a 0 return value indicates that the connection
was shutdown at the other end.
"""
self
.
_checkClosed
()
self
.
_checkReadable
()
while
True
:
...
...
@@ -260,17 +269,28 @@ class SocketIO(io.RawIOBase):
raise
def
write
(
self
,
b
):
"""Write the given bytes or bytearray object *b* to the socket
and return the number of bytes written. This can be less than
len(b) if not all data could be written. If the socket is
non-blocking and no bytes could be written None is returned.
"""
self
.
_checkClosed
()
self
.
_checkWritable
()
return
self
.
_sock
.
send
(
b
)
def
readable
(
self
):
"""True if the SocketIO is open for reading.
"""
return
self
.
_reading
and
not
self
.
closed
def
writable
(
self
):
"""True if the SocketIO is open for writing.
"""
return
self
.
_writing
and
not
self
.
closed
def
fileno
(
self
):
"""Return the file descriptor of the underlying socket.
"""
self
.
_checkClosed
()
return
self
.
_sock
.
fileno
()
...
...
@@ -283,6 +303,9 @@ class SocketIO(io.RawIOBase):
return
self
.
_mode
def
close
(
self
):
"""Close the SocketIO object. This doesn't close the underlying
socket, except if all references to it have disappeared.
"""
if
self
.
closed
:
return
io
.
RawIOBase
.
close
(
self
)
...
...
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