Scroll to navigation

NET_DestroyStreamSocket(3) SDL_net3 FUNCTIONS NET_DestroyStreamSocket(3)

NAME

NET_DestroyStreamSocket - Dispose of a previously-created stream socket.

SYNOPSIS

#include <SDL3_net/SDL_net.h>
void NET_DestroyStreamSocket(NET_StreamSocket *sock);  /* Destroy your sockets when finished with them. Does not block, handles shutdown internally. */

DESCRIPTION

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 NET_GetStreamSocketPendingWrites() or NET_WaitUntilStreamSocketDrained(). Any data that has arrived from the remote end of the connection that hasn't been read yet is lost.

FUNCTION PARAMETERS

stream socket to destroy.

THREAD SAFETY

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.

AVAILABILITY

This function is available since SDL_net 3.0.0.

SEE ALSO

NET_CreateClient(3), NET_AcceptClient(3), NET_GetStreamSocketPendingWrites(3), NET_WaitUntilStreamSocketDrained(3)

SDL_net 3.1.0 SDL_net