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
3f1c4720
Kaydet (Commit)
3f1c4720
authored
Nis 03, 1998
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use {methoddesc} as appropriate.
üst
5dabeed4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
76 deletions
+74
-76
libsocket.tex
Doc/lib/libsocket.tex
+37
-38
libsocket.tex
Doc/libsocket.tex
+37
-38
No files found.
Doc/lib/libsocket.tex
Dosyayı görüntüle @
3f1c4720
...
...
@@ -189,60 +189,59 @@ Socket objects have the following methods. Except for
\method
{
makefile()
}
these correspond to
\UNIX
{}
system calls
applicable to sockets.
\setindexsubitem
{
(socket method)
}
\begin{funcdesc}
{
accept
}{}
\begin{methoddesc}
[socket]
{
accept
}{}
Accept a connection.
The socket must be bound to an address and listening for connections.
The return value is a pair
\code
{
(
\var
{
conn
}
,
\var
{
address
}
)
}
where
\var
{
conn
}
is a
\emph
{
new
}
socket object usable to send and
receive data on the connection, and
\var
{
address
}
is the address bound
to the socket on the other end of the connection.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
bind
}{
address
}
\begin{
methoddesc}
[socket]
{
bind
}{
address
}
Bind the socket to
\var
{
address
}
. The socket must not already be bound.
(The format of
\var
{
address
}
depends on the address family --- see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
close
}{}
\begin{
methoddesc}
[socket]
{
close
}{}
Close the socket. All future operations on the socket object will fail.
The remote end will receive no more data (after queued data is flushed).
Sockets are automatically closed when they are garbage-collected.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
connect
}{
address
}
\begin{
methoddesc}
[socket]
{
connect
}{
address
}
Connect to a remote socket at
\var
{
address
}
.
(The format of
\var
{
address
}
depends on the address family --- see
above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
connect
_
ex
}{
address
}
\begin{
methoddesc}
[socket]
{
connect
_
ex
}{
address
}
Like
\code
{
connect(
\var
{
address
}
)
}
, but return an error indicator
instead of raising an exception. The error indicator is 0 if the
operation succeeded, otherwise the value of the
\cdata
{
errno
}
variable. This is useful
e.g.
for asynchronous connects.
\end{
func
desc}
variable. This is useful
, e.g.,
for asynchronous connects.
\end{
method
desc}
\begin{
funcdesc}
{
fileno
}{}
\begin{
methoddesc}
[socket]
{
fileno
}{}
Return the socket's file descriptor (a small integer). This is useful
with
\function
{
select.select()
}
.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
getpeername
}{}
\begin{
methoddesc}
[socket]
{
getpeername
}{}
Return the remote address to which the socket is connected. This is
useful to find out the port number of a remote IP socket, for instance.
(The format of the address returned depends on the address family ---
see above.) On some systems this function is not supported.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
getsockname
}{}
\begin{
methoddesc}
[socket]
{
getsockname
}{}
Return the socket's own address. This is useful to find out the port
number of an IP socket, for instance.
(The format of the address returned depends on the address family ---
see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
getsockopt
}{
level, optname
\optional
{
, buflen
}}
\begin{
methoddesc}
[socket]
{
getsockopt
}{
level, optname
\optional
{
, buflen
}}
Return the value of the given socket option (see the
\UNIX
{}
man page
\manpage
{
getsockopt
}{
2
}
). The needed symbolic constants
(
\constant
{
SO
_
*
}
etc.) are defined in this module. If
\var
{
buflen
}
...
...
@@ -252,15 +251,15 @@ the maximum length of the buffer used to receive the option in, and
this buffer is returned as a string. It is up to the caller to decode
the contents of the buffer (see the optional built-in module
\module
{
struct
}
for a way to decode C structures encoded as strings).
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
listen
}{
backlog
}
\begin{
methoddesc}
[socket]
{
listen
}{
backlog
}
Listen for connections made to the socket. The
\var
{
backlog
}
argument
specifies the maximum number of queued connections and should be at
least 1; the maximum value is system-dependent (usually 5).
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
makefile
}{
\optional
{
mode
\optional
{
, bufsize
}}}
\begin{
methoddesc}
[socket]
{
makefile
}{
\optional
{
mode
\optional
{
, bufsize
}}}
Return a
\dfn
{
file object
}
associated with the socket. (File objects
were described earlier in
\ref
{
bltin-file-objects
}
, ``File Objects.'')
The file object references a
\cfunction
{
dup()
}
ped version of the
...
...
@@ -268,49 +267,49 @@ socket file descriptor, so the file object and socket object may be
closed or garbage-collected independently. The optional
\var
{
mode
}
and
\var
{
bufsize
}
arguments are interpreted the same way as by the
built-in
\function
{
open()
}
function.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
recv
}{
bufsize
\optional
{
, flags
}}
\begin{
methoddesc}
[socket]
{
recv
}{
bufsize
\optional
{
, flags
}}
Receive data from the socket. The return value is a string representing
the data received. The maximum amount of data to be received
at once is specified by
\var
{
bufsize
}
. See the
\UNIX
{}
manual page
\manpage
{
recv
}{
2
}
for the meaning of the optional argument
\var
{
flags
}
; it defaults to zero.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
recvfrom
}{
bufsize
\optional
{
, flags
}}
\begin{
methoddesc}
[socket]
{
recvfrom
}{
bufsize
\optional
{
, flags
}}
Receive data from the socket. The return value is a pair
\code
{
(
\var
{
string
}
,
\var
{
address
}
)
}
where
\var
{
string
}
is a string
representing the data received and
\var
{
address
}
is the address of the
socket sending the data. The optional
\var
{
flags
}
argument has the
same meaning as for
\method
{
recv()
}
above.
(The format of
\var
{
address
}
depends on the address family --- see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
send
}{
string
\optional
{
, flags
}}
\begin{
methoddesc}
[socket]
{
send
}{
string
\optional
{
, flags
}}
Send data to the socket. The socket must be connected to a remote
socket. The optional
\var
{
flags
}
argument has the same meaning as for
\method
{
recv()
}
above. Returns the number of bytes sent.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
sendto
}{
string
\optional
{
, flags
}
, address
}
\begin{
methoddesc}
[socket]
{
sendto
}{
string
\optional
{
, flags
}
, address
}
Send data to the socket. The socket should not be connected to a
remote socket, since the destination socket is specified by
\var
{
address
}
. The optional
\var
{
flags
}
argument has the same
meaning as for
\method
{
recv()
}
above. Return the number of bytes sent.
(The format of
\var
{
address
}
depends on the address family --- see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
setblocking
}{
flag
}
\begin{
methoddesc}
[socket]
{
setblocking
}{
flag
}
Set blocking or non-blocking mode of the socket: if
\var
{
flag
}
is 0,
the socket is set to non-blocking, else to blocking mode. Initially
all sockets are in blocking mode. In non-blocking mode, if a
\method
{
recv()
}
call doesn't find any data, or if a
\code
{
send
}
call can't
immediately dispose of the data, a
\exception
{
error
}
exception is
raised; in blocking mode, the calls block until they can proceed.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
setsockopt
}{
level, optname, value
}
\begin{
methoddesc}
[socket]
{
setsockopt
}{
level, optname, value
}
Set the value of the given socket option (see the
\UNIX
{}
man page
\manpage
{
setsockopt
}{
2
}
). The needed symbolic constants are defined in
the
\module
{
socket
}
module (
\code
{
SO
_
*
}
etc.). The value can be an
...
...
@@ -319,14 +318,14 @@ up to the caller to ensure that the string contains the proper bits
(see the optional built-in module
\module
{
struct
}
\refbimodindex
{
struct
}
for a way to encode C structures
as strings).
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
shutdown
}{
how
}
\begin{
methoddesc}
[socket]
{
shutdown
}{
how
}
Shut down one or both halves of the connection. If
\var
{
how
}
is
\code
{
0
}
, further receives are disallowed. If
\var
{
how
}
is
\code
{
1
}
,
further sends are disallowed. If
\var
{
how
}
is
\code
{
2
}
, further sends
and receives are disallowed.
\end{
func
desc}
\end{
method
desc}
Note that there are no methods
\method
{
read()
}
or
\method
{
write()
}
;
use
\method
{
recv()
}
and
\method
{
send()
}
without
\var
{
flags
}
argument
...
...
Doc/libsocket.tex
Dosyayı görüntüle @
3f1c4720
...
...
@@ -189,60 +189,59 @@ Socket objects have the following methods. Except for
\method
{
makefile()
}
these correspond to
\UNIX
{}
system calls
applicable to sockets.
\setindexsubitem
{
(socket method)
}
\begin{funcdesc}
{
accept
}{}
\begin{methoddesc}
[socket]
{
accept
}{}
Accept a connection.
The socket must be bound to an address and listening for connections.
The return value is a pair
\code
{
(
\var
{
conn
}
,
\var
{
address
}
)
}
where
\var
{
conn
}
is a
\emph
{
new
}
socket object usable to send and
receive data on the connection, and
\var
{
address
}
is the address bound
to the socket on the other end of the connection.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
bind
}{
address
}
\begin{
methoddesc}
[socket]
{
bind
}{
address
}
Bind the socket to
\var
{
address
}
. The socket must not already be bound.
(The format of
\var
{
address
}
depends on the address family --- see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
close
}{}
\begin{
methoddesc}
[socket]
{
close
}{}
Close the socket. All future operations on the socket object will fail.
The remote end will receive no more data (after queued data is flushed).
Sockets are automatically closed when they are garbage-collected.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
connect
}{
address
}
\begin{
methoddesc}
[socket]
{
connect
}{
address
}
Connect to a remote socket at
\var
{
address
}
.
(The format of
\var
{
address
}
depends on the address family --- see
above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
connect
_
ex
}{
address
}
\begin{
methoddesc}
[socket]
{
connect
_
ex
}{
address
}
Like
\code
{
connect(
\var
{
address
}
)
}
, but return an error indicator
instead of raising an exception. The error indicator is 0 if the
operation succeeded, otherwise the value of the
\cdata
{
errno
}
variable. This is useful
e.g.
for asynchronous connects.
\end{
func
desc}
variable. This is useful
, e.g.,
for asynchronous connects.
\end{
method
desc}
\begin{
funcdesc}
{
fileno
}{}
\begin{
methoddesc}
[socket]
{
fileno
}{}
Return the socket's file descriptor (a small integer). This is useful
with
\function
{
select.select()
}
.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
getpeername
}{}
\begin{
methoddesc}
[socket]
{
getpeername
}{}
Return the remote address to which the socket is connected. This is
useful to find out the port number of a remote IP socket, for instance.
(The format of the address returned depends on the address family ---
see above.) On some systems this function is not supported.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
getsockname
}{}
\begin{
methoddesc}
[socket]
{
getsockname
}{}
Return the socket's own address. This is useful to find out the port
number of an IP socket, for instance.
(The format of the address returned depends on the address family ---
see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
getsockopt
}{
level, optname
\optional
{
, buflen
}}
\begin{
methoddesc}
[socket]
{
getsockopt
}{
level, optname
\optional
{
, buflen
}}
Return the value of the given socket option (see the
\UNIX
{}
man page
\manpage
{
getsockopt
}{
2
}
). The needed symbolic constants
(
\constant
{
SO
_
*
}
etc.) are defined in this module. If
\var
{
buflen
}
...
...
@@ -252,15 +251,15 @@ the maximum length of the buffer used to receive the option in, and
this buffer is returned as a string. It is up to the caller to decode
the contents of the buffer (see the optional built-in module
\module
{
struct
}
for a way to decode C structures encoded as strings).
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
listen
}{
backlog
}
\begin{
methoddesc}
[socket]
{
listen
}{
backlog
}
Listen for connections made to the socket. The
\var
{
backlog
}
argument
specifies the maximum number of queued connections and should be at
least 1; the maximum value is system-dependent (usually 5).
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
makefile
}{
\optional
{
mode
\optional
{
, bufsize
}}}
\begin{
methoddesc}
[socket]
{
makefile
}{
\optional
{
mode
\optional
{
, bufsize
}}}
Return a
\dfn
{
file object
}
associated with the socket. (File objects
were described earlier in
\ref
{
bltin-file-objects
}
, ``File Objects.'')
The file object references a
\cfunction
{
dup()
}
ped version of the
...
...
@@ -268,49 +267,49 @@ socket file descriptor, so the file object and socket object may be
closed or garbage-collected independently. The optional
\var
{
mode
}
and
\var
{
bufsize
}
arguments are interpreted the same way as by the
built-in
\function
{
open()
}
function.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
recv
}{
bufsize
\optional
{
, flags
}}
\begin{
methoddesc}
[socket]
{
recv
}{
bufsize
\optional
{
, flags
}}
Receive data from the socket. The return value is a string representing
the data received. The maximum amount of data to be received
at once is specified by
\var
{
bufsize
}
. See the
\UNIX
{}
manual page
\manpage
{
recv
}{
2
}
for the meaning of the optional argument
\var
{
flags
}
; it defaults to zero.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
recvfrom
}{
bufsize
\optional
{
, flags
}}
\begin{
methoddesc}
[socket]
{
recvfrom
}{
bufsize
\optional
{
, flags
}}
Receive data from the socket. The return value is a pair
\code
{
(
\var
{
string
}
,
\var
{
address
}
)
}
where
\var
{
string
}
is a string
representing the data received and
\var
{
address
}
is the address of the
socket sending the data. The optional
\var
{
flags
}
argument has the
same meaning as for
\method
{
recv()
}
above.
(The format of
\var
{
address
}
depends on the address family --- see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
send
}{
string
\optional
{
, flags
}}
\begin{
methoddesc}
[socket]
{
send
}{
string
\optional
{
, flags
}}
Send data to the socket. The socket must be connected to a remote
socket. The optional
\var
{
flags
}
argument has the same meaning as for
\method
{
recv()
}
above. Returns the number of bytes sent.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
sendto
}{
string
\optional
{
, flags
}
, address
}
\begin{
methoddesc}
[socket]
{
sendto
}{
string
\optional
{
, flags
}
, address
}
Send data to the socket. The socket should not be connected to a
remote socket, since the destination socket is specified by
\var
{
address
}
. The optional
\var
{
flags
}
argument has the same
meaning as for
\method
{
recv()
}
above. Return the number of bytes sent.
(The format of
\var
{
address
}
depends on the address family --- see above.)
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
setblocking
}{
flag
}
\begin{
methoddesc}
[socket]
{
setblocking
}{
flag
}
Set blocking or non-blocking mode of the socket: if
\var
{
flag
}
is 0,
the socket is set to non-blocking, else to blocking mode. Initially
all sockets are in blocking mode. In non-blocking mode, if a
\method
{
recv()
}
call doesn't find any data, or if a
\code
{
send
}
call can't
immediately dispose of the data, a
\exception
{
error
}
exception is
raised; in blocking mode, the calls block until they can proceed.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
setsockopt
}{
level, optname, value
}
\begin{
methoddesc}
[socket]
{
setsockopt
}{
level, optname, value
}
Set the value of the given socket option (see the
\UNIX
{}
man page
\manpage
{
setsockopt
}{
2
}
). The needed symbolic constants are defined in
the
\module
{
socket
}
module (
\code
{
SO
_
*
}
etc.). The value can be an
...
...
@@ -319,14 +318,14 @@ up to the caller to ensure that the string contains the proper bits
(see the optional built-in module
\module
{
struct
}
\refbimodindex
{
struct
}
for a way to encode C structures
as strings).
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
shutdown
}{
how
}
\begin{
methoddesc}
[socket]
{
shutdown
}{
how
}
Shut down one or both halves of the connection. If
\var
{
how
}
is
\code
{
0
}
, further receives are disallowed. If
\var
{
how
}
is
\code
{
1
}
,
further sends are disallowed. If
\var
{
how
}
is
\code
{
2
}
, further sends
and receives are disallowed.
\end{
func
desc}
\end{
method
desc}
Note that there are no methods
\method
{
read()
}
or
\method
{
write()
}
;
use
\method
{
recv()
}
and
\method
{
send()
}
without
\var
{
flags
}
argument
...
...
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