Hi,

I'm trying to move an iterative server (a small multiplayer card game)
from using select() to poll()  (BTW is it a good idea at all?)

I have to use iterative design instead of a forking one, because it is 
easier to move players between tables and the chatroom this way.

So it is important for me that none of the reads/writes/accepts block.

My question is, what events should I poll() ? With select() it is easy -

    read/write won't block if FD_ISSET is set for that socket and:
    1) read/write returns > 0 means ok
    2) read/write returns = 0 means connection closed
    3) read/write returns < 0 means connection interrupted

But with poll() it is unclear. The Stevens' book says it is implementation-
specific, but the OpenBSD manpage doesn't describe, what is considered 
high-priority data (for example, I listen on a non-blocking socket. If a new 
client connects, is it high-priority or not? Will POLLIN suffice here?)

If I poll() for POLLIN/POLLOUT, will the read/write ever block?

Do I need to poll() for POLLHUP and/or POLLERR to detect
closed or interrupted connections or is POLLIN enough and it
is same as 2) and 3) above?

Regards
Alex

Reply via email to