You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PING command is used to test the presence of an active client or
server at the other end of the connection. Servers send a PING
message at regular intervals if no other activity detected coming
from a connection. If a connection fails to respond to a PING
message within a set amount of time, that connection is closed. A
PING message MAY be sent even if the connection is active.
We would need to keep track of the timestamp of the last command sent by a client. We could then check the elapsed time on every pollout event for that client, and if the elapsed time is too long, send a PING command to the client. Then we would have a flag requirePong, and a timestamp for our sent PING. If the requirePong is true, we would check the elapsed time since PING was sent. If the elapsed time is over the timeout period, disconnect and inform others, if not, check if the command is PONG, if it is, flip the requirePong to false.
The text was updated successfully, but these errors were encountered:
RFC 2812:
We would need to keep track of the timestamp of the last command sent by a client. We could then check the elapsed time on every pollout event for that client, and if the elapsed time is too long, send a PING command to the client. Then we would have a flag requirePong, and a timestamp for our sent PING. If the requirePong is true, we would check the elapsed time since PING was sent. If the elapsed time is over the timeout period, disconnect and inform others, if not, check if the command is PONG, if it is, flip the requirePong to false.
The text was updated successfully, but these errors were encountered: