If I perform an operation that establishes a TCP connection (e.g., an HTTP connection), the first thing that happens is that the 3-step TCP handshake is made. If I then use netstat, it shows me that there is a TCP connection with state ESTABLISHED:
$ netstat -an | grep ESTAB
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 <source IP>:49472 <destination IP>:80 ESTABLISHED
How does
netstatknow that my client software made a TCP handshake with the server and that there now is an established connection? My best guess is thatnetstatlooks at file descriptors or something else in the OS that holds this information, but I can't find any information about it.Can I somehow check the connections in the same way that
netstatinternally does?