Hello! How can I trace a broken TCP connection? You can send some kind of special message and wait for an answer ... and if they did not wait, then define it as a break ... But this is somehow not very. Is there an easier way to determine if the connection is broken by the north and the client?
- oneonly pings. That is, the question-answer. Or directly contact the network card. - KoVadim
- pings are not always processed by the server - let's say if there is a ban on replies to pings - Barmaley
- Reliably, only with its application protocol (with its timeouts). I understand that the standard 1.5 hours do not suit you. @KoVadim, under the direct access to the network card did you mean to determine whether there is a carrier? And someone else's regular card will not respond to any package. - avp
- Ping - what are you talking about? ICMP or small packets back and forth over a tcp connection? @KoVadim and if the connection is lost far from your card? @Alerr are you talking about? Breaking TCP connections is one thing. Breaking a cable somewhere along the route is another. So what are you worried about? - alexlz
- 2usually protocols above use keepalive, i.e. the client sends messages to the server once every n time, and the server also goes to the client, the same method is used by scouts and dragdalers (I will not call - kill them all) - zb
|
1 answer
At the level of network protocols, the surest way, as already advised in the comments, is the implementation of the so-called. "ripple" or "ping" in the top-level protocol (of your own). I strongly recommend reading Josef Snyder - Effective TCP / IP programming, the first advice is clearly described what TCP reliability is.
The rest of the ways are narrowly focused and limited to have the right to life.
|