ARTICLE AD BOX
#include <mstcpip.h>
TCP_INFO_v0 info = {0};
DWORD bytes;
if (WSAIoctl(sock, SIO_TCP_INFO, NULL, 0, &info, sizeof(info), &bytes, NULL, NULL) == 0) {
// Current "fill" level
uint64_t inFlight = info.BytesOut - info.BytesAcked;
}
WSAIoctl: This is a gateway function used to control or query specific socket behaviors that aren't covered by standard Berkeley sockets.
SIO_TCP_INFO: This flag tells Windows, "Give me the current statistics for this specific TCP connection."
BytesOut: The total number of bytes your application has handed to the stack that have been sent out.
BytesAcked: The total number of bytes the remote device has confirmed it received.
So, the difference between Out and Acked - its actual amount of data that still in pending state
