Transferring Data

Read Special


Read specially tagged data from a connection.

#include "laygo.h"

LResult lgo_ReadSpecial
        LCid           cid,
        LDataBuffer    buffer,
        LBufferSize    size,
        LDataFlags *   flags
cidconnection to read from
bufferbuffer to receive data into
sizesize of receive buffer in bytes
flagsstorage for protocol-specific flags received with data

lgo_ReadSpecial() reads specially tagged data from a connection. It can be used to read untagged data. In this case, flags will be set to zero. The minimum and maximum number of bytes which can be requested in one call to lgo_ReadSpecial() depends on the configuration of the system buffer pool and the underlying protocols.

If lgo_ReadSpecial() fails with an error code of lgo_ERROR_BUFFER_SIZE, the application may call lgo_Poll() to determine the number of bytes of data waiting to be read.

The meaning of the data flags is defined by the protocol.

Return Values

If successful, lgo_ReadSpecial() returns a non-negative value indicating the number of bytes read into the buffer. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

A return value of 0 means that there are neither data nor control events waiting to be read.

The special data flags are returned through the flags parameter.

See Also


if ((bytes = lgo_Read(cid, buffer, size, &flags)) < 0)
    /* process error */
else if (bytes > 0)
    /* process read data */
    /* process other CIDs */