Socket: 7.1 Sending and Receiving Data: Urgent Data

Up: GEOS SDK TechDocs| Up | Prev: 7 Sending and Receiving Data | Next: 7.2 SocketSend() and SocketRecv()

The Socket library supports the notion of urgent data. This allows a short packet of data to cut in front of other packets. To send a packet marked urgent, pass the SSF_URGENT flag to SocketSend() .

In some domains, only one byte of data in a packet can be marked urgent. In such a domain, passing SSF_URGENT with a 32-byte packet to SocketSend() results in two packets being sent: a 1-byte urgent packet and a 31-byte non-urgent packet. The data of the 1-byte urgent packet is the last byte of the original 32-byte packet. Check your domain documentation for size limits on urgent packets.

Urgent data may be delivered out of order. It may arrive out of sync with non-urgent packets; it may arrive out of order with other urgent packets. There is no queue for urgent data. Each urgent data packet received causes the previous urgent data to be discarded.

The SocketRecv() routine, in charge of receiving incoming packets, may be instructed to receive only urgent data or only non-urgent data. If there is pending urgent data and SocketRecv() is told to poll for normal data, it will return an error value, SE_URGENT, signalling that the program should call SocketRecv() again, this time to receive urgent data. (If, instead, you call SocketRecv() telling it to receive normal data again, it will return any pending normal data; it will not generate the SE_URGENT exception for the pending piece of urgent data -- unless another piece of urgent data has arrived in the meantime.)

Datagram connections do not support urgent data; SocketRecv() generates an SE_URGENT error on a datagram connection, it's really generating a SE_EXCEPTION value. If you receive such an error, it is a sign that the network is having troubles and packets may not be getting through.

You may force incoming urgent data to be treated in the same manner as normal data by setting the socket's "in-line" option. See SO_INLINE: In-line urgent data To force urgent data to be treated the same as normal data. This allows you to poll for both urgent and normal data with a single SocketRecv() command. Of course, setting this option means that you will not receive for information about socket options.


Up: GEOS SDK TechDocs| Up | Prev: 7 Sending and Receiving Data | Next: 7.2 SocketSend() and SocketRecv()