sdlNetUdpGetPeerAddress function

Pointer<IPaddress> sdlNetUdpGetPeerAddress(
  1. Pointer<UDPsocket> sock,
  2. int channel
)

Get the IP address of the remote system for a socket and channel.

If channel is -1, then the primary IP port of the UDP socket is returned -- this is only meaningful for sockets opened with a specific port.

If the channel is not bound and not -1, this function returns NULL.

\param sock the UDP socket to unbind addresses from a channel on. \param channel the channel of the socket to unbind. \returns the address bound to the socket's channel, or

\since This function is available since SDL_net 2.0.0.

extern DECLSPEC IPaddress * SDLCALL SDLNet_UDP_GetPeerAddress(UDPsocket sock, int channel)

Implementation

Pointer<IPaddress> sdlNetUdpGetPeerAddress(
    Pointer<UDPsocket> sock, int channel) {
  final sdlNetUdpGetPeerAddressLookupFunction = libSdl2Net.lookupFunction<
      Pointer<IPaddress> Function(Pointer<UDPsocket> sock, Int32 channel),
      Pointer<IPaddress> Function(
          Pointer<UDPsocket> sock, int channel)>('SDLNet_UDP_GetPeerAddress');
  return sdlNetUdpGetPeerAddressLookupFunction(sock, channel);
}