summaryrefslogtreecommitdiffstats
path: root/man2/recv.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/recv.2')
-rw-r--r--man2/recv.254
1 files changed, 27 insertions, 27 deletions
diff --git a/man2/recv.2 b/man2/recv.2
index 395236d..916cca3 100644
--- a/man2/recv.2
+++ b/man2/recv.2
@@ -10,7 +10,7 @@
.\" Modified 1998,1999 by Andi Kleen
.\" 2001-06-19 corrected SO_EE_OFFENDER, bug report by James Hawtin
.\"
-.TH recv 2 2023-07-18 "Linux man-pages 6.05.01"
+.TH recv 2 2024-02-18 "Linux man-pages 6.7"
.SH NAME
recv, recvfrom, recvmsg \- receive a message from a socket
.SH LIBRARY
@@ -19,7 +19,7 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <sys/socket.h>
-.PP
+.P
.BI "ssize_t recv(int " sockfd ", void " buf [. len "], size_t " len ,
.BI " int " flags );
.BI "ssize_t recvfrom(int " sockfd ", void " buf "[restrict ." len "], size_t " len ,
@@ -39,7 +39,7 @@ They may be used
to receive data on both connectionless and connection-oriented sockets.
This page first describes common features of all three system calls,
and then describes the differences between the calls.
-.PP
+.P
The only difference between
.BR recv ()
and
@@ -54,27 +54,27 @@ is generally equivalent to
.BR read (2)
(but see NOTES).
Also, the following call
-.PP
+.P
.in +4n
.EX
recv(sockfd, buf, len, flags);
.EE
.in
-.PP
+.P
is equivalent to
-.PP
+.P
.in +4n
.EX
recvfrom(sockfd, buf, len, flags, NULL, NULL);
.EE
.in
-.PP
+.P
All three calls return the length of the message on successful
completion.
If a message is too long to fit in the supplied buffer, excess
bytes may be discarded depending on the type of socket the message is
received from.
-.PP
+.P
If no messages are available at the socket, the receive calls wait for a
message to arrive, unless the socket is nonblocking (see
.BR fcntl (2)),
@@ -84,7 +84,7 @@ is set to
.BR EAGAIN " or " EWOULDBLOCK .
The receive calls normally return any data available, up to the requested
amount, rather than waiting for receipt of the full amount requested.
-.PP
+.P
An application can use
.BR select (2),
.BR poll (2),
@@ -123,7 +123,7 @@ is a per-call option, whereas
is a setting on the open file description (see
.BR open (2)),
which will affect all threads in the calling process
-and as well as other processes that hold file descriptors
+as well as other processes that hold file descriptors
referring to the same open file description.
.TP
.BR MSG_ERRQUEUE " (since Linux 2.2)"
@@ -250,7 +250,7 @@ places the received message into the buffer
.IR buf .
The caller must specify the size of the buffer in
.IR len .
-.PP
+.P
If
.I src_addr
is not NULL,
@@ -278,7 +278,7 @@ 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
+.P
If the caller is not interested in the source address,
.I src_addr
and
@@ -293,7 +293,7 @@ call is normally used only on a
socket (see
.BR connect (2)).
It is equivalent to the call:
-.PP
+.P
.in +4n
.EX
recvfrom(fd, buf, len, flags, NULL, 0);
@@ -308,7 +308,7 @@ call uses a
structure to minimize the number of directly supplied arguments.
This structure is defined as follows in
.IR <sys/socket.h> :
-.PP
+.P
.in +4n
.EX
struct msghdr {
@@ -322,7 +322,7 @@ struct msghdr {
};
.EE
.in
-.PP
+.P
The
.I msg_name
field points to a caller-allocated buffer that is used to
@@ -336,14 +336,14 @@ will contain the length of the returned address.
If the application does not need to know the source address,
.I msg_name
can be specified as NULL.
-.PP
+.P
The fields
.I msg_iov
and
.I msg_iovlen
describe scatter-gather locations, as discussed in
.BR readv (2).
-.PP
+.P
The field
.IR msg_control ,
which has length
@@ -358,9 +358,9 @@ should contain the length of the available buffer in
.IR msg_control ;
upon return from a successful call it will contain the length
of the control message sequence.
-.PP
+.P
The messages are of the form:
-.PP
+.P
.in +4n
.EX
struct cmsghdr {
@@ -373,10 +373,10 @@ struct cmsghdr {
};
.EE
.in
-.PP
+.P
Ancillary data should be accessed only by the macros defined in
.BR cmsg (3).
-.PP
+.P
As an example, Linux uses this ancillary data mechanism to pass extended
errors, IP options, or file descriptors over UNIX domain sockets.
For further information on the use of ancillary data in various
@@ -384,7 +384,7 @@ socket domains, see
.BR unix (7)
and
.BR ip (7).
-.PP
+.P
The
.I msg_flags
field in the
@@ -427,14 +427,14 @@ if an error occurred.
In the event of an error,
.I errno
is set to indicate the error.
-.PP
+.P
When a stream socket peer has performed an orderly shutdown,
the return value will be 0 (the traditional "end-of-file" return).
-.PP
+.P
Datagram sockets in various domains (e.g., the UNIX and Internet domains)
permit zero-length datagrams.
When such a datagram is received, the return value is 0.
-.PP
+.P
The value 0 may also be returned if the requested number of bytes
to receive from a stream socket was 0.
.SH ERRORS
@@ -515,7 +515,7 @@ POSIX.1-2008.
.SH HISTORY
POSIX.1-2001,
4.4BSD (first appeared in 4.2BSD).
-.PP
+.P
POSIX.1 describes only the
.BR MSG_OOB ,
.BR MSG_PEEK ,
@@ -535,7 +535,7 @@ In this circumstance,
has no effect (the datagram remains pending), while
.BR recv ()
consumes the pending datagram.
-.PP
+.P
See
.BR recvmmsg (2)
for information about a Linux-specific system call