Open a UDP network socket.
Defined in <SDL_net.h>
UDPsocket SDLNet_UDP_Open(Uint16 port);
Uint16 | port | the UDP port to bind this socket to. |
(UDPsocket) Returns a new UDP socket, ready to communicate.
If port
is non-zero, the UDP socket is bound to a local port.
The port
should be given in native byte order, but is used internally in network (big endian) byte order, in addresses, etc. This allows other systems to send to this socket via a known port.
Note that UDP sockets at the platform layer "bind" to a nework port number, but SDL_net's UDP sockets also "bind" to a "channel" on top of that, with SDLNet_UDP_Bind(). But the term is used for both.
When you are done communicating over the returned socket, you can shut it down and free its resources with SDLNet_UDP_Close().
This function is available since SDL_net 2.0.0.