1

Can anyone suggest C++ program for checking dropped TCP Connection. How will I know if the connection half dropped?

I want to check if the connection is dropped in every loop run.

user4581301
  • 33,082
  • 7
  • 33
  • 54
  • Additionally to the link above, you might be interesting to read about TCP keep-alive function. – dmi Feb 21 '17 at 06:32
  • There is no really good way to do this. TCP is designed to send move data or die trying and it can take a really, really long time to give up and die. Keepalives is one possibility, but again, slow. If you need to know quickly TCP may not the the protocol for you. @ShmuelH. 's Dupe is good though, especially if you read through the comments. – user4581301 Feb 21 '17 at 06:37
  • Ah yes, depending on the needs. Besides TCP keep-alive, an application keep-alive ping-pong can be implemented. This will add some extra network traffic, but will help you to test not only the connection itself, but also the responsivness of the peer, and you can control the time of no response in a quite wide range. – dmi Feb 21 '17 at 07:03

0 Answers0