NET_GetStreamSocketPendingWrites(3)

NAME
NET_GetStreamSocketPendingWrites - Query bytes still pending transmission on a stream socket.

SYNOPSIS
#include <SDL3_net/SDL_net.h>

int NET_GetStreamSocketPendingWrites(NET_StreamSocket *sock);

DESCRIPTION
If NET_WriteToStreamSocket() couldn't send all its data immediately, it will queue it to be sent later. This function lets the app see how much of that queue is still pending to be sent.

The library will try to send more queued data before reporting what's left, but it will not block to do so.

If the connection has failed (remote side dropped us, or one of a million other networking failures occurred), this function will report failure by returning -1. Stream sockets only report failure for unrecoverable conditions; once a stream socket fails, you should assume it is no longer usable and should destroy it with NET_DestroyStreamSocket().

FUNCTION PARAMETERS

sock
    the stream socket to query.

RETURN VALUE
Returns number of bytes still pending transmission, -1 on failure; call SDL_GetError() for details.

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_WriteToStreamSocket(3), NET_WaitUntilStreamSocketDrained(3)