示例#1
0
 /// <summary>
 /// Closes the socket
 /// </summary>
 public void Close()
 {
     if (ConnectionSocket != null)
     {
         if (ConnectionSocket.Connected)
         {
             ConnectionSocket.Disconnect(true);
         }
         ConnectionSocket.Shutdown(SocketShutdown.Both);
         ConnectionSocket.Close();
     }
 }
示例#2
0
        public virtual void Disconnect(bool allowReuse = false)
        {
            //Check not already Connected.
            if (((NetworkConnectionState)Flags).HasFlag(NetworkConnectionState.Connected))
            {
                ConnectionSocket.Disconnect(allowReuse);

                base.Disconnect();

                UnFlagConnected();

                Refresh();
            }
        }