Can I get the TCP window size for the current connection before sending data using the Linux API to send or send

Is there a Linux API available that I can get the TCP window size for the current TCP connection before sending data using the Linux API to send or send?

The reason I need this is if the current size of the TCP window is less than the length of the data I need to send, I can free the CPU manually and do something else in other threads or processes.

+4
source share
1 answer

Maybe there is a better method, but, in many ways, it occurred to me to use RAW SOCKET .

Processing data at the transport level allows you to access the TCP header (and then the 16-bit window column).

Another is that you have to process the TCP stack between you and the partner, which is a little crazy and time consuming.

This is an example of what you need to do to JUST send SYN to the host. Avoid the last cycle, otherwise it will start an in-phase attack against your partner :)

TCP with RAW SOCKETS

0
source

All Articles