Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpeudp.RdpeudpSocket.ManageKeepLive C# (CSharp) Method

ManageKeepLive() private method

Function used to manage keep alive timer
private ManageKeepLive ( object state ) : void
state object
return void
        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();
            }
        }