IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page

int recv ( int  sd,
char *  bufPtr,
int  bufLen,
int  flags,
unsigned long  timeout,
int *  error 

This function is used to receive messages from another socket.

[in] sd The socket descriptor
[out] bufPtr Pointer to input buffer where received characters will be stored.
[in] bufLen Maximum characters to store in buffer at bufptr
[in] flags Wait option:
MSG_BLOCKING - Sleep until data comes in.
MSG_TIMEOUT - The caller wakes up after timeout or if any data is received.
MSG_PEEK - Peek at the data present on the socket. The data is returned, but not consumed, so that a subsequent receive operation will see the same data.
MSG_DONTWAIT - Return immediately after collecting what ever data is ready.
[in] timeout Maximum milliseconds to wait if flags is set to MSG_TIMEOUT
[out] error Failure code, 0 on success.
>=0: Count of received bytes stored in buffer at bufptr (0 if time-out)
-1: Failure (see error output parameter)
This API function applies only to TCP sockets and may be used only on a connected socket (see connect(), accept()).
If flags parameter is set to MSG_DONTWAIT, this API call returns immediately. If no data is available -1 is returned and output parameter error is set to 235 (EWOULDBLOCK).
If flags parameter is set to MSG_BLOCKING, the recv call waits for a message to arrive.
By default all sockets are opened in the blocking mode.
If however a socket was subsequently set to non blocking mode with the SocketBlockingMode() function, the MSG_BLOCKING flag will then not work here.
BSD4.4 Compatibility:

This function as described above is not compatible to the BSD 4.4 Socket API.
The recv() call can be used in BSD 4.4 compatible mode, if the define switch


is set at the user application.
Using this switch the CLIB TCPIP.H redefines recv() to recv_bsd().

SC2x3 V1.00 - CLIB V1.00

Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Thu Nov 1 13:20:16 2018 by Doxygen 1.6.1