24.5 Summary
TCP does not have true out-of-band data. It
provides an urgent pointer that is sent in the TCP header to the
peer as soon as the sender goes into urgent mode. The receipt of
this pointer by the other end of the connection tells that process
that the sender has gone into urgent mode, and the pointer points
to the final byte of urgent data. But all the data is still subject
to TCP's normal flow control.
The sockets API maps TCP's urgent mode into what
it calls out-of-band data. The sender goes into urgent mode by
specifying the MSG_OOB flag in a call to send.
The final byte of data in this call is considered the out-of-band
byte. The receiver is notified when its TCP receives a new urgent
pointer by either the SIGURG signal, or by an indication
from select that the socket has an exception condition
pending. By default, TCP takes the out-of-band byte out of the
normal stream of data and places it into its own one-byte
out-of-band buffer that the process reads by calling recv
with the MSG_OOB flag. Alternately, the receiver can set
the SO_OOBINLINE socket option, in which case, the
out-of-band byte is left in the normal stream of data. Regardless
of which method is used by the receiver, the socket layer maintains
an out-of-band mark in the data stream and will not read through
the mark with a single input operation. The receiver determines if
it has reached the mark by calling the sockatmark
function.
Out-of-band data is not heavily used.
telnet and rlogin use it, as does FTP; they all
use it to notify the remote end of an exceptional condition (e.g.,
client interrupt), and the servers discard all input received
before the out-of-band mark.
|