Home > Net >  C # winForm socket server and client communication
C # winForm socket server and client communication

Time:04-06

Server side has a test client abnormal break line reconnection functions using KeepAlive mechanism application case, [face] monkey2:019 PNG [/face]

CodePudding user response:

Write this thing, you are normal, as long as your so-called heartbeat package no special significance, normal writing, (heartbeat packets have special meaning of some systems)

Most of the time we say, as long as you don't superstitious the great god of so-called advanced articles, you can get normal normal processing as a result, it is every day to see the so-called senior, but is a pile of "senior bug
"
You write this just normal, the only need to deal with is to handle the "SocketOption" parameter, don't need the great god, or that sentence and gods long-term behavior are selective one-way promotion disease

These great gods want to promote their blog, will only use exaggerated and one-sided fool way, to promote their things, and they will be selective amnesia things they don't want to promote -- -- -- -- -- -- -- -- -- this is a kind of disease, must treat, don't treat, we can only again and again to see more programmers to learn the basis of their set of "senior bug" way of code everywhere
There are so few parameters in option
Second keepalive_time: unit, said before sending detection message link free time, default is 7200,
Seconds keepalive_intvl: unit, said two detection message sending time interval, the default is 75,
Keepalive_probes: to detect the number of times the default nine

Is the great gods will be selective amnesia, keealive itself is the mechanism of TCP itself, and they promote their that kind of thing, can selectively forgotten this, they would say if the TCP broken network, anomaly can be received immediately, and so cannot be immediately choose reconnection operations such as

We have to tell you, they have to selective amnesia disease caused by that, because the option keepalive_time defaults to 7200 seconds, which is the default free heart examination time is 2 hours, so they couldn't immediately be exceptions, so want to solve this problem, simply open sokect handle in your time, change the default option can
  •  Tags:  
  • C#
  • Related