sdlNetUdpOpen function
Open a UDP network socket.
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().
\param port the UDP port to bind this socket to. \returns a new UDP socket, ready to communicate.
\since This function is available since SDL_net 2.0.0.
\sa SDLNet_UDP_Close \sa SDLNet_UDP_Bind
extern DECLSPEC UDPsocket SDLCALL SDLNet_UDP_Open(Uint16 port)
Implementation
Pointer<UDPsocket> sdlNetUdpOpen(int port) {
final sdlNetUdpOpenLookupFunction = libSdl2Net.lookupFunction<
Pointer<UDPsocket> Function(Uint16 port),
Pointer<UDPsocket> Function(int port)>('SDLNet_UDP_Open');
return sdlNetUdpOpenLookupFunction(port);
}