Hello,
I have a question regarding the use of "select" system call to detect
the exception condition caused by arrival of "out-of-band" data.
I am running into the following problem (item 4 below describes the
actual problem)
(1) A signal handler is associated with the SIGURG signal. Thus,
when an out-of-band data arrives, the signal handler is called.
The signal handler uses the "select" system call to determine
which sockets have exception conditions. It reads an out-of-band
byte on each socket that has the exception.
(using recv(fd, &data, 1, MSG_OOB))
(2) process A and B both send one byte of out-of-band data
to process C (using send(fd, &data, 1, MSG_OOB)).
(3) The out-of-band data from A arrives first and causes
the signal handler to be called.
The socket (say, Sa) connecting C and A is detected to have
an exception. The signal handler reads a byte (out-of-order)
from that socket. No exception is detected on the socket
(say Sb) connecting B and C.
(4) The signal handler is called again when the out-of-band data
arrives from B to process C.
There cannot be any pending out-of-order data from A on socket Sa.
However, when "select" is called, it indicates that BOTH
sockets Sa and Sb have an exception condition.
An attempt to recv(fd, &data, 1, MSG_OOB) on socket Sa returns
error EINVAL (as there is no out-of-band data on that socket).
Should socket Sa show an exception condition when the out-of-band
data has already been read ?
Or, do I have to do something to "clear" the exception condition
after the out-of-band data is read ?
I would appreciate your reply. Please send your reply
- nitin vaidya