Hi Alejandro, while reading the recv manpage I came up with some suggestions which I believe would make it easier for the reader. They are not corrections (except for the last block, which I believe was incomplete), just improvements (IMHO). What do You think about them? Signed-off-by: Rob Linden <rlinden@xxxxxxxxxx> >From 4f4ea0984d0a207960121f142e1b9e181194ef8e Mon Sep 17 00:00:00 2001 From: rokkbert <rokkbert@xxxxxxxxx> Date: Tue, 13 Jun 2023 17:55:08 +0200 Subject: [PATCH] recv.2: increased verbosity and, hopefully, understandability a bit. --- man2/recv.2 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/man2/recv.2 b/man2/recv.2 index 3697d0c84..f675f65aa 100644 --- a/man2/recv.2 +++ b/man2/recv.2 @@ -92,7 +92,10 @@ 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. +received from, e.g. for +.BR SOCK_DGRAM ", but not for " SOCK_STREAM . +To find out how many bytes are available see the flags +.BR MSG_PEEK " and " MSG_TRUNC . .PP If no messages are available at the socket, the receive calls wait for a message to arrive, unless the socket is nonblocking (see @@ -100,7 +103,7 @@ message to arrive, unless the socket is nonblocking (see in which case the value \-1 is returned and .I errno is set to -.BR EAGAIN " or " EWOULDBLOCK . +.BR EAGAIN " or " EWOULDBLOCK " (see " ERRORS ). The receive calls normally return any data available, up to the requested amount, rather than waiting for receipt of the full amount requested. .PP @@ -256,7 +259,8 @@ For use with Internet stream sockets, see .TP .BR MSG_WAITALL " (since Linux 2.2)" This flag requests that the operation block until the full request is -satisfied. +satisfied, i.e. +.BR len " bytes have been written to the buffer." 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. @@ -432,8 +436,9 @@ is returned to indicate that expedited or out-of-band data was received. indicates that no data was received but an extended error from the socket error queue. .SH RETURN VALUE -These calls return the number of bytes received, or \-1 -if an error occurred. +These calls return the number of bytes copied to buf, the number of bytes +received by the socket (see +.BR MSG_TRUNC "), or -1 if an error occurred." In the event of an error, .I errno is set to indicate the error. -- 2.39.2 All the best, rob