Asynchronous sending function, used to send data on a UDP socket.
Called by the application code when there is data required to be sent on a UDP socket handler. The application code is expected to receive data from a successful bounded socket node. The only difference between this function and the similar send function, is the type of socket the data is received on. This function works only with UDP sockets. After the data is sent, the socket callback function registered using registerSocketCallback(), is expected to receive an event of type SOCKET_MSG_SENDTO.
Functions | |
NMI_API sint16 | sendto (SOCKET sock, void *pvSendBuffer, uint16 u16SendLength, uint16 flags, struct sockaddr *pstrDestAddr, uint8 u8AddrLen) |
Asynchronous sending function, used to send data on a UDP socket. Called by the application code when there is data required to be sent on a UDP socket. More... | |
NMI_API sint16 sendto | ( | SOCKET | sock, |
void * | pvSendBuffer, | ||
uint16 | u16SendLength, | ||
uint16 | flags, | ||
struct sockaddr * | pstrDestAddr, | ||
uint8 | u8AddrLen | ||
) |
Asynchronous sending function, used to send data on a UDP socket. Called by the application code when there is data required to be sent on a UDP socket.
The application code is expected to receive data from a successfully bound socket node. The only difference between this function and the similar send function, is the type of socket the data is received on. This function works only with UDP sockets. After the data is sent, the socket callback function registered using registerSocketCallback(), is expected to receive an event of type SOCKET_MSG_SENDTO.
[in] | sock | Socket ID, must hold a non negative value. A negative value will return a socket error SOCK_ERR_INVALID_ARG. Indicating that an invalid argument is passed in. |
[in] | pvSendBuffer | Pointer to a buffer holding data to be transmitted. A NULL value will return a socket error SOCK_ERR_INVALID_ARG. Indicating that an invalid argument is passed in. |
[in] | u16SendLength | The buffer size in bytes. It must not exceed SOCKET_BUFFER_MAX_LENGTH. |
[in] | flags | Not used in the current implementation |
[in] | pstrDestAddr | The destination address. |
[in] | u8AddrLen | Destination address length in bytes. Not used in the current implementation, only included for BSD compatibility. |
[in] | sock | Socket ID, must hold a non negative value. A negative value will return a socket error SOCK_ERR_INVALID_ARG. Indicating that an invalid argument is passed in. |
[in] | pvSendBuffer | Pointer to a buffer holding data to be transmitted. A NULL value will return a socket error SOCK_ERR_INVALID_ARG. Indicating that an invalid argument is passed in. |
[in] | u16SendLength | The buffer size in bytes. It must not exceed SOCKET_BUFFER_MAX_LENGTH. |
[in] | flags | Not used in the current implementation |
[in] | pstrDestAddr | The destination address. |
[in] | u8AddrLen | Destination address length in bytes. Not used in the current implementation, only included for BSD compatibility. |
References IP_PACKET_OFFSET, M2M_HIF_HDR_OFFSET, M2M_HIF_MAX_PACKET_SIZE, m2m_memset(), M2M_REQ_DATA_PKT, MAX_SOCKET, NM_BSP_B_L_16, NULL, RAW_SOCK_ID, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, tstrSendCmd::sock, SOCK_ERR_BUFFER_FULL, SOCK_ERR_INVALID_ARG, SOCK_ERR_NO_ERROR, SOCKET_BUFFER_MAX_LENGTH, SOCKET_CMD_SENDTO, SOCKET_REQUEST, tstrSendCmd::strAddr, tstrSendCmd::u16DataSize, tstrSockAddr::u16Family, tstrSockAddr::u16Port, tstrSocket::u16SessionID, tstrSendCmd::u16SessionID, tstrSockAddr::u32IPAddr, and UDP_TX_PACKET_OFFSET.
Referenced by demo_start(), handle_incoming_rrep(), IperfSocketEventHandler(), IperfUDP_SendTestPacket(), main(), run_udp_client(), send_rrep(), and socket_cb().