Strange behaviour of recv with MSG_WAITALL option

I was writing a thread that recieves everething coming from TCP socket. When
I use MSG_WAITALL, something strange happens: after reveiving a few (about
50) portions of data I don’t get anything though I can see data in rcv
buffer with netstat. The thread is REPLY - blocked on recv. If I send data
to the socket at the same time, it works a little better, but when I stop
sending it gets the same. I had to use recv without MSG_WAITALL, but I think
it takes more IPC overhead because I may not have enoug data available in
the buffer and getting a number of bytes takes a few loops.
Does anybody know if nonblocking IO is more effective?

Dmitry Androshchuk.

This occurs when the size of you read is > the receive buffer
size. It is fixed in 6.2. And you’re right, this can make a
nice difference, especially on “faster” machines.

-seanb

Dmitry P. Androschuk <adp@texpo.kiev.ua> wrote:
: I was writing a thread that recieves everething coming from TCP socket. When
: I use MSG_WAITALL, something strange happens: after reveiving a few (about
: 50) portions of data I don’t get anything though I can see data in rcv
: buffer with netstat. The thread is REPLY - blocked on recv. If I send data
: to the socket at the same time, it works a little better, but when I stop
: sending it gets the same. I had to use recv without MSG_WAITALL, but I think
: it takes more IPC overhead because I may not have enoug data available in
: the buffer and getting a number of bytes takes a few loops.
: Does anybody know if nonblocking IO is more effective?

: Dmitry Androshchuk.