Unfortunately, the standard API does not reserve a suitable way to do this. There may be a way to request the current size / use of the TCP send window, but, unfortunately, it cannot be requested by standard means.
Of course, there are complex ways to achieve what you want. For example, on Windows, you can create a surge protector to monitor packet-level traffic.
source share