6.2.3.10 recv/recvfrom
The recv and recvfrom functions are used
to read data from TCP and UDP sockets, respectively, and their operation is otherwise
identical.
The host MCU application calls the recv or
recvfrom function with a pre allocated buffer. When the
SOCKET_MSG_RECV or SOCKET_MSG_RECVFROM event
callback arrives, this buffer must have the received data.
The received data size indicates the status as follows:
- Positive – data is received
- Zero – socket connection is terminated
- Negative – indicates an error
In the case of TCP sockets, it is recommended to call the
recv function after each successful socket connection (client or
server). Otherwise, the received data is buffered in the ATWINC15x0 firmware wasting the system's resources until the socket is
explicitly closed using a close function call.
