lgo_DiscardData()
Discard a waiting data packet.
#include "laygo.h" LResult lgo_DiscardData ( LCid cid );
cid | connection with data waiting to be read |
lgo_DiscardData() discards a waiting data packet. Only data, CRC error, aborted frame and length error events can be discarded in this way. Control events must be read using lgo_Event().
lgo_DiscardData() is intended primarily for applications using only a physical layer, without the services of a link or packet layer. In this case, data which would normally be discarded by higher layer protocols is passed to the application and may be discarded without being read.
If successful, lgo_DiscardData() returns a non-negative value. 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: lgo_DiscardData(cid); break; default: /* process nondata event */ break; } }