sppSend()
PROTOTYPE
#include <spp.h>
int sppSend(const void *src, int length);
DESCRIPTION
sppSend() sends a frame of user data. src points to a buffer that holds the data to send. length, the number of bytes to send, must be less than or equal to SPP_MAX_I_FIELD (defined in “spp.h”).
If a send buffer is free or non-blocking mode has been set, sppSend() returns immediately. Otherwise, the call blocks until a previously sent data frame is acknowledged (which frees a send buffer) or the link is reset.
If successful, sppSend() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| SPP_LEN_TOO_BIG | length is greater than SPP_MAX_I_FIELD. |
| SPP_UNCONNECTED | The channel is unconnected. |
| SPP_UNINITIALIZED | The initialization routine sppInit() has not been called. |
| SPP_WOULD_BLOCK | The API is non-blocking and no send buffers are free. |
EXAMPLE
/*---------------------------------------------------------------*/
/* Send max length frame, break if error. */
/*---------------------------------------------------------------*/
if (sppSend(sbuf, SPP_MAX_I_FIELD))
{
perror("sppSend()");
break;
}