Syntax
short SendtoSc(SOCKET sock,
void *pvSendBuffer,
unsigned short u16SendLength,
unsigned short flags,
struct sockaddr *pstrDestAddr,
unsigned char u8AddrLen
);
Parameters
- sock
-
[in] Socket descriptor
- pvSendBuffer
-
[in] Specify the send buffer.
- u16SendLength
- [in] Specify the size of the data to be sent.The upper limit of the size of the transmitted data is SOCKET_BUFFER_MAX_LENGTH (= 1400).
- flags
-
[in] Please specify 0.
- pstrDestAddr
-
[in] Specify the destination socket address with sockaddr structure.
In this library, define a sockaddr_in structure and use it for sockaddr structure with cast. - u8AddrLen
-
[in] Specify the size of the sockaddr structure.
In this library, specify the size of sockaddr_in structure.
Return value
The following values will be returned.Value | Description |
---|---|
SOCK_ERR_NO_ERROR | Succeeded |
M2M_ERR_SLEEP_FAIL | Initialize with SysWLANInit function. |
Other than the above | Failed |
Remarks
Send using UDP socket.Only available on UDP sockets.
The processing request of this function is processed asynchronously. The processing result is received by the callback function specified by the pfAppSocketCb parameter of the RegSocketCallbackSc function. The following values are passed to the parameters of the callback function.
- sock
- Socket descriptor
- u8Msg
- SOCKET_MSG_SENDTO
- pvMsg
-
A pointer to a short type variable that stores the processing result. The values of the variables are:
Value Description Sent data size Succeeded Negative value Failed
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Last updated: 2020/11/26