sdlNetTcpGetPeerAddress function

Pointer<IPaddress> sdlNetTcpGetPeerAddress(
  1. Pointer<TCPsocket> sock
)

Get the IP address of the remote system associated with the socket.

If the socket is a server socket, this function returns NULL.

This returns a pointer to internal memory; you should not modify or free it, and should assume it's only valid until the socket is given to SDLNet_TCP_Close.

\param sock the socket to query. \returns the address information for the socket.

\since This function is available since SDL_net 2.0.0.

extern DECLSPEC IPaddress * SDLCALL SDLNet_TCP_GetPeerAddress(TCPsocket sock)

Implementation

Pointer<IPaddress> sdlNetTcpGetPeerAddress(Pointer<TCPsocket> sock) {
  final sdlNetTcpGetPeerAddressLookupFunction = libSdl2Net.lookupFunction<
      Pointer<IPaddress> Function(Pointer<TCPsocket> sock),
      Pointer<IPaddress> Function(
          Pointer<TCPsocket> sock)>('SDLNet_TCP_GetPeerAddress');
  return sdlNetTcpGetPeerAddressLookupFunction(sock);
}