I establish a TCP connection from my setup to another setup ( The other setup is not under my control i.e. I cannot manipulate it ).Lets consider 1st setup as A and second as B.

Now setup B breaks the connection from its side , sending FYN , receiving ACK from A and then going in FIN_WAIT_2 state.

Now A is at CLOSE_WAIT state , when i look in netstat. Is there any way , i can fetch the state of the TCP connection in my code. Thanks in advance