sdlNetTcpOpen function

Pointer<TCPsocket> sdlNetTcpOpen(
  1. Pointer<IPaddress> ip
)

Open a TCP network socket.

If ip->host is INADDR_NONE or INADDR_ANY, this creates a local server socket on the given port, otherwise a TCP connection to the remote host and port is attempted. The address passed in should already be swapped to network byte order (addresses returned from SDLNet_ResolveHost() are already in the correct form).

\param ip The address to open a connection to (or to host a server on). \returns the newly created socket, or NULL if there was an error.

\since This function is available since SDL_net 2.0.0.

\sa SDLNet_TCP_Close

extern DECLSPEC TCPsocket SDLCALL SDLNet_TCP_Open(IPaddress *ip)

Implementation

Pointer<TCPsocket> sdlNetTcpOpen(Pointer<IPaddress> ip) {
  final sdlNetTcpOpenLookupFunction = libSdl2Net.lookupFunction<
      Pointer<TCPsocket> Function(Pointer<IPaddress> ip),
      Pointer<TCPsocket> Function(Pointer<IPaddress> ip)>('SDLNet_TCP_Open');
  return sdlNetTcpOpenLookupFunction(ip);
}