NET_PRES_SocketRead Function

C

uint16_t NET_PRES_SocketRead(NET_PRES_SKT_HANDLE_T handle, void * buffer, uint16_t size); 

Returns

The number of bytes read from the socket. If less than len, the RX FIFO buffer became empty or the socket is not connected.

Description

This function reads an array of data bytes from a socket's RX buffer/FIFO. The data is removed from the FIFO in the process. If the connection is encrypted this function calls the encryption provider's read function, otherwise it calls the transport layer's read function.

Remarks

For encrypted connections, a null buffer is an invalid parameter. For non encrypted connections if the supplied buffer is null, the data is simply discarded.

Preconditions

A socket needs to have been opened by NET_PRES_SocketOpen.

Parameters

ParametersDescription
handleThe presentation layer socket handle.
bufferThe pointer to the array to store data that was read.
sizeThe number of bytes to be read.