lgo_Poll()
Poll for the presence of control or data events.
#include "laygo.h" LEvent lgo_Poll ( LCid cid, LBufferSize * count );
cid | connection to poll for events |
count | on output, size of buffer needed to receive the event |
lgo_Poll() tests for the receipt of control and data events. If lgo_Read() or lgo_ReadSpecial() fails with an error code of lgo_ERROR_BUFFER_SIZE, an application may call lgo_Poll() to determine the number of bytes of data waiting to be read.
If successful, lgo_Poll() returns a non-negative value indicating the type of control event received. Possible successful return values are:
Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:
if ((event = lgo_Poll(cid, &bufferSize)) < 0) { /* process error */ } else { switch(event) { case lgo_EVENT_DATA_OK: /* read good data */ break; case lgo_EVENT_DATA_LENGTH_ERROR: case lgo_EVENT_DATA_CRC_ERROR: case lgo_EVENT_DATA_ABORTED_FRAME: /* discard bad data */ break; default: /* process events */ break; } }