Developer

API Reference

ISOCKET_SendTo()

Brew Release
Brew MP 1.0.2
See Also
ISOCKET_RecvFrom() INAddr INPort
Description
This function sends a UDP packet to the specified IP address and port from the local port bound to the socket. This function must be used with sockets of type AEE_NET_DGRAM (UDP), not with sockets of type AEE_NET_STREAM (TCP). If the socket has not been bound to a local address and port, this function binds it to a port. Sockets always operate in a non-blocking mode. This function returns immediately and, if successful, returns the number of bytes written. If no bytes are successfully sent and the connection is still active, the function returns AEE_NET_WOULDBLOCK. To be notified when to call ISOCKET_SendTo() again, the caller must call ISOCKET_Writeable(). Prior to performing any socket-specific behavior, ISOCKET_Connect() will perform an ISOCKET_Realize() if necessary.
Two flags are supported for the SendTo operation on UDP sockets: - ISOCKET_FLAG_SENDTO_URGENT flag will attempt to deliver the message even
if the network is asleep (e.g. on a common channel instead of a dedicated channel). There will probably be limits on the size of such signaling, even if it is supported. See the INETMGR_GetOpt() function for details. This feature should be used with discretion, and requires a privilege: NET_URGENT must be specified as an external dependency in the application's MIF in order to utilize this option. It will be useful for applications with very low bandwidth requirements or applications which are sensitive to the additional network delay of waiting for the network to be awakened from dormancy. - ISOCKET_FLAG_SENDTO_WAKEUP flag can be used in conjunction with the ISOCKET_FLAG_SENDTO_URGENT
flag to concurrently request that the network should be awakened from dormancy as soon as possible, subsequent to the message delivery. If only the ISOCKET_FLAG_SENDTO_WAKEUP is set, UDP data will NOT be sent. This feature requires System privileges.
Parameters
  • pISocket
    []:
    Pointer to the ISocket Interface object.
  • pBuff
    []:
    Buffer containing data to be sent.
  • wBytes
    []:
    Size of the buffer, in terms of number of bytes.
  • wflags
    []:
    Data transport options. ISOCKET_FLAG_SENDTO_WAKEUP ISOCKET_FLAG_SENDTO_URGENT
  • a
    []:
    IP Address in network byte order.
  • wPort
    []:
    Port in network byte order.
Interface
ISOCKET
Prototype
    int32 ISOCKET_SendTo
    (
    ISocket * pISocket,
                        byte * pBuff,
                        uint16 wBytes,
                        uint16 wflags,
    INAddr a,
    INPort wPort
    )
Return
bytes_sent ( > 0) Any positive number indicates the number of bytes successfully sent.
AEE_NET_WOULDBLOCK: Cannot send data at this time. Use ISOCKET_Writeable() to wait for readiness. This condition could be encountered if transmit buffers have been filled, or when a network connection is being established.
AEE_NET_ERROR: Indicates failure. The specific error code can be retrieved by calling ISOCKET_GetLastError(). One of the AEE Error Codes is returned
Side Effect
None.
Comment
AEE_NET_EMFILE errors can be reported here if too many sockets are open.
  • Follow