private void ManageKeepLive(object state)
{
if (!Connected)
{
return;
}
if (LastReceiveDiagramTime + this.SocketConfig.LostConnectionTimeOut <= DateTime.Now)
{
// If the sender does not receive any ACK from the receiver after 65 seconds, the connection is terminated.
this.Close();
}
if (LastSendDiagramTime + this.SocketConfig.KeepaliveDuration <= DateTime.Now)
{
// Send an ACK packet to keep alive
this.SendAcKPacket();
}
}