mirror of https://github.com/mkerrisk/man-pages
recv.2: Isolate details specific to recv() vs recvfrom() vs recvmsg()
Place details specific to each system call under a a separate subheading. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
7cb04a61d3
commit
183ec51374
83
man2/recv.2
83
man2/recv.2
|
@ -66,47 +66,6 @@ system calls are used to receive messages from a socket.
|
|||
They may be used
|
||||
to receive data on both connectionless and connection-oriented sockets.
|
||||
.PP
|
||||
If
|
||||
.I src_addr
|
||||
is not NULL, and the underlying protocol provides the source address,
|
||||
this source address is filled in.
|
||||
When
|
||||
.I src_addr
|
||||
is NULL, nothing is filled in; in this case,
|
||||
.I addrlen
|
||||
is not used, and should also be NULL.
|
||||
.\" (Note: for datagram sockets in both the UNIX and Internet domains,
|
||||
.\" .I src_addr
|
||||
.\" is filled in.
|
||||
.\" .I src_addr
|
||||
.\" is also filled in for stream sockets in the UNIX domain, but is not
|
||||
.\" filled in for stream sockets in the Internet domain.)
|
||||
.\" [The above notes on AF_UNIX and AF_INET sockets apply as at
|
||||
.\" Kernel 2.4.18. (MTK, 22 Jul 02)]
|
||||
The argument
|
||||
.I addrlen
|
||||
is a value-result argument,
|
||||
which the caller should initialize before the call to
|
||||
the size of the buffer associated with
|
||||
.IR src_addr ,
|
||||
and modified on return to indicate the actual size of the source address.
|
||||
The returned address is truncated if the buffer provided is too small;
|
||||
in this case,
|
||||
.I addrlen
|
||||
will return a value greater than was supplied to the call.
|
||||
.PP
|
||||
The
|
||||
.BR recv ()
|
||||
call is normally used only on a
|
||||
.I connected
|
||||
socket (see
|
||||
.BR connect (2))
|
||||
and is identical to
|
||||
.BR recvfrom ()
|
||||
with a NULL
|
||||
.I src_addr
|
||||
argument.
|
||||
.PP
|
||||
All three routines return the length of the message on successful
|
||||
completion.
|
||||
If a message is too long to fit in the supplied buffer, excess
|
||||
|
@ -280,7 +239,49 @@ satisfied.
|
|||
However, the call may still return less data than requested if
|
||||
a signal is caught, an error or disconnect occurs, or the next data to be
|
||||
received is of a different type than that returned.
|
||||
.SS recvfrom()
|
||||
.PP
|
||||
If
|
||||
.I src_addr
|
||||
is not NULL, and the underlying protocol provides the source address,
|
||||
this source address is filled in.
|
||||
When
|
||||
.I src_addr
|
||||
is NULL, nothing is filled in; in this case,
|
||||
.I addrlen
|
||||
is not used, and should also be NULL.
|
||||
.\" (Note: for datagram sockets in both the UNIX and Internet domains,
|
||||
.\" .I src_addr
|
||||
.\" is filled in.
|
||||
.\" .I src_addr
|
||||
.\" is also filled in for stream sockets in the UNIX domain, but is not
|
||||
.\" filled in for stream sockets in the Internet domain.)
|
||||
.\" [The above notes on AF_UNIX and AF_INET sockets apply as at
|
||||
.\" Kernel 2.4.18. (MTK, 22 Jul 02)]
|
||||
The argument
|
||||
.I addrlen
|
||||
is a value-result argument,
|
||||
which the caller should initialize before the call to
|
||||
the size of the buffer associated with
|
||||
.IR src_addr ,
|
||||
and modified on return to indicate the actual size of the source address.
|
||||
The returned address is truncated if the buffer provided is too small;
|
||||
in this case,
|
||||
.I addrlen
|
||||
will return a value greater than was supplied to the call.
|
||||
.SS recv()
|
||||
The
|
||||
.BR recv ()
|
||||
call is normally used only on a
|
||||
.I connected
|
||||
socket (see
|
||||
.BR connect (2))
|
||||
and is identical to
|
||||
.BR recvfrom ()
|
||||
with a NULL
|
||||
.I src_addr
|
||||
argument.
|
||||
.SS recvmsg()
|
||||
The
|
||||
.BR recvmsg ()
|
||||
call uses a
|
||||
|
|
Loading…
Reference in New Issue