sppRecv()
PROTOTYPE
#include <spp.h>
int sppRecv(void *dst);
DESCRIPTION
sppRecv() receives a frame of user data. dst points to a buffer the user data is copied to. It must be at least as large as SPP_MAX_I_FIELD (defined in “spp.h”). If a received frame is waiting or non-blocking mode has been set, the call returns immediately. Otherwise, sppRecv() blocks until a frame is received or the link is reset.
Receipt of a RST frame (which resets the connection) does not flush the queue of received data. Data frames received in order before the RST frame arrived can be read via sppRecv() until a following sppDisc() or sppConn(). Received data frames that follow a sequence number gap are not available to be read.
If successful, sppRecv() returns the number of user data bytes received. Otherwise, it sets errno and returns -1.
ERROR CODES
| SPP_UNCONNECTED | The channel is unconnected. |
| SPP_UNINITIALIZED | The initialization routine sppInit() has not been called. |
| SPP_WOULD_BLOCK | API is non-blocking and no received data frame is queud. |
EXAMPLE
/*-----------------------------------------------------------------*/
/* Wait indefinitely for received frames. */
/*-----------------------------------------------------------------*/
rlen = sppRecv(rbuf);