out-of-band data on tcp-sockets

out-of-band data on tcp-sockets

Post by Thomas Fun » Sat, 04 Jul 1992 00:43:31

I have a serious problem:

A process is expecting (waiting for) OOB-Data (out-of-band, urgent) on a  
stream-socket. I'm doing a 'select' with the exception-fd's enabled, and  
that works. The problem is, that sometimes the select returns too early, so  
a following 'recv' with MSG_OOB does fail. Currently I'm polling the 'recv',  
thus looping until it returns OK, but I believe that is not a good solution.  
Is there any way to avoid this looping ?

The SIGURG-signal does not work either, it's also sent too early. I'm  
running a AIX/RS6000 and a NeXT, both with the same behaviour. And from the  
docs, I think this is a feature not a bug :-(

Any help appreciated, if possible respond via e-mail !

Thomas Funke, Gasteinerstr. 29, 1000 Berlin 31, Germany.



1. Out-of-band data on sockets - how to detect "true" exceptions ?


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

2. find with pipe to grep

3. BSD Sockets and Out-of-Band data

4. Info on threads in Solaris

5. select & out-of-band socket data

6. Problems with 0.98.2

7. HELP with Sockets using OOB data (Out-Of-Band)

8. connecting to multiple news servers

9. socket out-of-band data

10. sockets and out-of-band data

11. Out-Of-Band-Data on TCP-Sockets

12. Out-of-band data - how? (please help, urgent)