Summary TCP urgent data provides a way for one process to signal another via a TCP stream that some time-critical event has occurred. Although the urgent signal is transmitted "out of band," meaning that it is delivered to the remote host in a priority fashion, the urgent data itself is not truly out of band but is subject to the same sequencing and flow-control rules as ordinary TCP data. To read the contents of the urgent data, it may be necessary to read (and possibly discard) normal data until the urgent data becomes available. Hence, urgent data is easiest to work with when it is the existence of the data that counts and not its actual contents. In addition to reading the contents of the urgent data byte, you can discover its position in the data stream using the sockatmark() function. This provides a way to mark a section of the TCP data stream for special treatment. In the travesty example, we used urgent data to mark a section of the data stream for disposal. Because of the restrictions on TCP urgent mode, you might consider the alternative of using two separate sockets, one for normal communication and the other for high-priority control data. Such an arrangement allows you to transmit and receive multibyte high-priority messages and eliminates the need for sockatmark() and other arcane issues. However, it will add to the complexity of your software by doubling the number of sockets that need to be managed. |