Microchip® Advanced Software Framework

tstrSocketRecvMsg Struct Reference

Socket recv status.

It is passed to the APPSocketEventHandler with SOCKET_MSG_RECV or SOCKET_MSG_RECVFROM message type in a response to a user call to the recv or recvfrom. If the received data from the remote peer is larger than the USER Buffer size (given at recv call), the data is delivered to the user in a number of consecutive chunks according to the USER Buffer size.

Socket receive information is returned through this structure in response to the asynchronous call to the @ref recv or @ref recvfrom socket functions.
This structure, together with the events @ref SOCKET_MSG_RECV or @ref SOCKET_MSG_RECVFROM, is passed-in parameters to the callback function.
Remarks
After receiving this structure, the application should issue a new call to recv or recvfrom in order to receive subsequent data.
In the case of SOCKET_MSG_RECVFROM (UDP), any further data in the same datagram is dropped, then subsequent datagrams are buffered on the WINC until the application provides a buffer via a new call to recvfrom.
In the case of SOCKET_MSG_RECV (TCP), all subsequent data is buffered on the WINC until the application provides a buffer via a new call to recv.
A negative or zero buffer size indicates an error with the following code: SOCK_ERR_NO_ERROR : Socket connection closed. The application should now call close(). SOCK_ERR_CONN_ABORTED : Socket connection aborted. The application should now call close(). SOCK_ERR_TIMEOUT : Socket receive timed out. The socket connection remains open.
Socket receive information is returned through this structure in response to the asynchronous call to the @ref recv or @ref recvfrom socket functions.
This structure, together with the events @ref SOCKET_MSG_RECV or @ref SOCKET_MSG_RECVFROM, is passed-in parameters to the callback function.
Remarks
After receiving this structure, the application should issue a new call to recv or recvfrom in order to receive subsequent data. In the case of SOCKET_MSG_RECVFROM (UDP), any further data in the same datagram is dropped, then subsequent datagrams are buffered on the WINC until the application provides a buffer via a new call to recvfrom. In the case of SOCKET_MSG_RECV (TCP), all subsequent data is buffered on the WINC until the application provides a buffer via a new call to recv. A negative or zero buffer size indicates an error with the following code: SOCK_ERR_NO_ERROR : Socket connection closed. The application should now call close(). SOCK_ERR_CONN_ABORTED : Socket connection aborted. The application should now call close(). SOCK_ERR_TIMEOUT : Socket receive timed out. The socket connection remains open.

#include <socket.h>

Data Fields

uint8pu8Buffer
 
sint16 s16BufferSize
 
struct sockaddr_in strRemoteAddr
 
uint16 u16RemainingSize
 

uint8 * tstrSocketRecvMsg::pu8Buffer

Pointer to the USER buffer (passed to recv and recvfrom function) containing the received data chunk.

Referenced by GROWL_APPSocketEventHandler(), IperfSocketEventHandler(), m2m_ip_cb(), prov_socket_cb(), socket_cb(), and Socket_ReadSocketData().

sint16 tstrSocketRecvMsg::s16BufferSize

The received data chunk size. Holds a negative value if there is a receive error or ZERO on success upon reception of close socket message.

Referenced by GROWL_APPSocketEventHandler(), http_client_socket_event_handler(), IperfSocketEventHandler(), m2m_ip_cb(), prov_socket_cb(), socket_cb(), and Socket_ReadSocketData().

struct sockaddr_in tstrSocketRecvMsg::strRemoteAddr

Socket address structure for the remote peer. It is valid for SOCKET_MSG_RECVFROM event.

Referenced by IperfSocketEventHandler(), and m2m_ip_cb().

uint16 tstrSocketRecvMsg::u16RemainingSize

This field is used internally by the driver. In normal operation, this field will be 0 when the application receives this structure.

Referenced by GROWL_APPSocketEventHandler(), IperfSocketEventHandler(), and Socket_ReadSocketData().