FreeRTOS: Secure Sockets
Return to main page ↑
SOCKETS_Recv

Receive data from a TCP socket.

int32_t SOCKETS_Recv( Socket_t xSocket,
void * pvBuffer,
size_t xBufferLength,
uint32_t ulFlags );

The socket must have already been created using a call to SOCKETS_Socket() and connected to a remote socket using SOCKETS_Connect().

See the Berkeley Sockets API in wikipedia

Parameters
[in]xSocketThe handle of the socket from which data is being received.
[out]pvBufferThe buffer into which the received data will be placed.
[in]xBufferLengthThe maximum number of bytes which can be received. pvBuffer must be at least xBufferLength bytes long.
[in]ulFlagsNot currently used. Should be set to 0.
Returns
  • If the receive was successful then the number of bytes received (placed in the buffer pointed to by pvBuffer) is returned.
  • If a timeout occurred before data could be received then 0 is returned (timeout is set using SOCKETS_SO_RCVTIMEO).
  • If an error occurred, a negative value is returned. SocketsErrors