winsock stuff

Alexandre Julliard julliard at
Mon Aug 20 19:59:33 CDT 2001

Daniel Walker <diwalker at> writes:

> 	How is it unreliable? Why is MSG_PEEK more reliable? I'm not opposed to
> using MSG_PEEK , just curios..

FIONREAD is unreliable because you cannot distinguish between an EOF
condition and an empty receive buffer. recvmsg(MSG_PEEK) is supposed
to return 0 on EOF, and EWOULDBLOCK on empty buffer, so you can
determine the real status.

> Another issue is why doesn't poll() give
> us a POLLHUP? That would be ideal, get poll() to work the way we need it
> too.

As I understand it poll() returns POLLHUP only when both directions of
the socket have been closed; but if you shutdown() only the read or
write side, you don't get POLLHUP so that you can continue using
poll() for the other direction. This has apparently been changed
between kernels 2.2 and 2.4; in 2.2 POLLHUP is returned as soon as the
read side of the socket has been closed.

Alexandre Julliard
julliard at

More information about the wine-devel mailing list