sdlNetDestroyStreamSocket function

void sdlNetDestroyStreamSocket(
  1. Pointer<SdlNetStreamSocket> sock
)

Dispose of a previously-created stream socket.

This will immediately disconnect the other side of the connection, if necessary. Further attempts to read or write the socket on the remote end will fail.

This will abandon any data queued for sending that hasn't made it to the socket. If you need this data to arrive, you should wait for it to transmit before destroying the socket with SDLNet_GetStreamSocketPendingWrites() or SDLNet_WaitUntilStreamSocketDrained(). Any data that has arrived from the remote end of the connection that hasn't been read yet is lost.

\param sock stream socket to destroy.

\threadsafety You should not operate on the same socket from multiple threads at the same time without supplying a serialization mechanism. However, different threads may access different sockets at the same time without problems.

\since This function is available since SDL_Net 3.0.0.

\sa SDLNet_CreateClient \sa SDLNet_AcceptClient \sa SDLNet_GetStreamSocketPendingWrites \sa SDLNet_WaitUntilStreamSocketDrained

extern SDL_DECLSPEC void SDLCALL SDLNet_DestroyStreamSocket(SDLNet_StreamSocket *sock)

Implementation

void sdlNetDestroyStreamSocket(Pointer<SdlNetStreamSocket> sock) {
  final sdlNetDestroyStreamSocketLookupFunction = libSdl3Net.lookupFunction<
      Void Function(Pointer<SdlNetStreamSocket> sock),
      void Function(
          Pointer<SdlNetStreamSocket> sock)>('SDLNet_DestroyStreamSocket');
  return sdlNetDestroyStreamSocketLookupFunction(sock);
}