Linux Socket Programming by Example - Warren Gay

< BACKCONTINUE >
159231153036212041242100244042145096184016146223183074028121223008110134183016163201153041179

Setting the SO_OOBINLINE Option

The topic of out-of-band data will be covered in Chapter 14, "Out-of-Band Data." Here, you can just note that in some circumstances limited amounts of data can be expedited ahead of data that might already be sent. Normally, this out-of-band data is received using a different method from the usual data receiving functions. There are times, however, when it is preferred to receive this out-of-band data in the normal manner. When this method is chosen, the out-of-band data arrives ahead of the normal data as part of the normal data stream.

To enable this feature, you could use the following code:

					
#define TRUE    1
#define FALSE   0

int z;  /* Status code */
int s;     /* Socket s */
int so_oobinline;


so_oobinline = TRUE;

z = setsockopt(s,
    SOL_SOCKET,
    SO_OOBINLINE,
    &so_oobinline,
    sizeof so_oobinline);

if ( z )
    perror("setsockopt(2)");</

				

After the option SO_OOBINLINE has been enabled, the out-of-band data will be received with the normal data. In this manner, the out-of-band data received is indistinguishable from the normal data.

< BACKCONTINUE >

Index terms contained in this section

data
     out-of-band
            SO_OOBINLINE socket option 2nd
out-of-band data
     SO_OOBINLINE socket option
            code example
            setting 2nd
setting
     socket options
            SO_OOBINLINE 2nd
SO_OOBINLINE socket option
      code example
      setting 2nd
sockets
     options
            SO_OOBINLINE 2nd