Jump to main content

##

# 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

Parameters | Description
--- | ---
handle | The presentation layer socket handle.
buffer | The pointer to the array to store data that was read.
size | The number of bytes to be read.