[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
On Monday 18 January 2010 19:28:01 Joerg Sonnenberger wrote:
> > 2. Connected sockets. Does kevent return when any new data arrives into
> > the socket buffer, or does it always return, provided socket buffer has
> > more than SO_RCVLOWAT bytes of data?
> This is documented in kevent(2).
The man page says:
Other socket descriptors return when there is data to be read, subject to the
SO_RCVLOWAT value of the socket buffer.
So it seems to suggest that kevent always returns as long as socket is
readable. If I call kevent and it returns with 600 bytes of data, and then I
call kevent again with the socket still holding 600 bytes of the same data,
kevent will return as before.
However this guy says the opposite:
On page 3, under "Dangers and Caveats" he says:
"If a socket has data available for reading, poll will return it. If you don't
read from the socket and call poll again, it is still readable and poll will
again return it. This is not the case with kqueue. The first call to kqueue
will indicate the socket is ready for reading, but the second will not. Why
not? Between the calls to kqueue, the socket's state has not changed. kqueue
only records changes in state, it never actually reads the current state. To
do so would mean returning to poll levels of scalability. The precise
defintion of what constitutes a state change depends on the object. In the
case of sockets, "available to read" is marked whenever new data arrives."
So which way is it then?
Main Index |
Thread Index |