示例#1
0
        /// <summary>
        /// Timer elapse event handler, raised only when the client has timed out
        /// </summary>
        /// <param name="source">The timer that elapsed.</param>
        /// <param name="e">Event arguments.</param>
        private void OnTimeoutEventHandler(object source, ElapsedEventArgs e)
        {
            TimeoutTimer timer = (TimeoutTimer)source;

            timer.Stop();
            Connection <T> connection = (Connection <T>)timer.Tag;

            DisconnectClient(connection);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the Connection class.
 /// </summary>
 public Connection(TcpClient client) : base(client)
 {
     Timer = new TimeoutTimer(this);
     Statu = ConnectStatu.Uncheck;
 }