コード例 #1
0
        private bool DoCloseConnection()
        {
            if (RemoteState != null)
            {
                RemoteState.GotDataToSend -= RemoteState_GotDataToSend;
                RemoteState.Close();
                RemoteState = null;

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public void Disconnect()
 {
     if (RemoteState != null && RemoteState.Close())
     {
         RemoteState = null;
         try
         {
             //Signal that we got disconnected
             if (Disconnected != null)
             {
                 Disconnected(this, new NetworkEventArgs(Hostname, Port));
             }
         }
         catch { }
     }
 }