Re: Error in SEND(2) man page ?

From: Robert Hancock
Date: Mon Dec 07 2009 - 22:06:42 EST


On 12/07/2009 12:43 PM, Jacques, Hugo wrote:

Hi,

I think I found a discrepancy between the man page of send()and the actual implementation.

Man page mentions that:

"[...] When the message does not fit into the send buffer of the socket, send() normally blocks, unless the socket has been placed in non-blocking I/O mode. In non-blocking mode it would fail with the error EAGAIN or EWOULDBLOCK in this case. [...]"

This tells me that if doing a send() on a tcp non-blocking socket whose send buffer is full, the call should return with -1 and errno=EAGAIN.

But running a trivial test app (code below), send() will indicate (return value) that is sent some but not all of the data buffer when the socket's send buffer is full.

Am I missing anything?
Is the man page or the code wrong?

I think the man page would be right for a datagram (ex: UDP) socket, but not for a stream (ex: TCP) socket, as a stream socket has no real concept of "messages".
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/