C
#define UDPOpen(localPort,remoteNode,remotePort) UDPOpenEx((DWORD)remoteNode,UDP_OPEN_NODE_INFO,localPort,remotePort)
Description
UDPOpen is a macro replacement of the legacy implementation of UDPOpen. Creates a UDP socket handle for transmiting or receiving UDP packets. Call this function to obtain a handle required by other UDP function.
Preconditions
UDPInit() must have been previously called.
Parameters
Parameters |
Description |
localPort |
UDP port number to listen on. If 0, stack will dynamically assign a unique port number to use. |
remoteNode |
Pointer to remote node info (MAC and IP address) for this connection. If this is a server socket (receives the first packet) or the destination is the broadcast address, then this parameter should be NULL. |
remotePort |
For client sockets, the remote port number. |
Return Values
Return Values |
Description |
Success |
A UDP socket handle that can be used for subsequent UDP API calls. |
Failure |
INVALID_UDP_SOCKET. This function fails when no more UDP socket handles are available. Increase MAX_UDP_SOCKETS to make more sockets available. |
Remarks
When finished using the UDP socket handle, call the UDPClose() function to free the socket and delete the handle.