Example #1
0
        private void OnCloseCompleted(IAsyncResult ar)
        {
            string remoteAddress = ar.AsyncState as string;

            if (!string.IsNullOrEmpty(remoteAddress))
            {
                ClientConnectManager.Remove(remoteAddress);
            }
        }
Example #2
0
 private void OnSocketClosing(object sender, EndPoint remotePoint)
 {
     try
     {
         string remoteAddress = remotePoint.ToString();
         if (!string.IsNullOrEmpty(remoteAddress))
         {
             if (_transponder.SocketClosing != null)
             {
                 _transponder.SocketClosing.BeginInvoke(sender, remotePoint, OnCloseCompleted, remoteAddress);
             }
             else
             {
                 ClientConnectManager.Remove(remoteAddress);
             }
         }
         TraceLog.ReleaseWrite("The {0} socket connection is closed.", remoteAddress);
     }
     catch (Exception ex)
     {
         TraceLog.WriteError("OnSocketClosing error:{0}", ex);
     }
 }