示例#1
0
        /// <summary>
        /// Stops the connection
        /// </summary>
        public void Stop(bool RaiseEvent)
        {
            stopped = true;
            try
            {
                client.Close();
            }
            catch { }

            try
            {
                ConnectionClosedArgs cca = new ConnectionClosedArgs();
                ConnectionClosed(this, cca);
            }
            catch { }
        }
示例#2
0
 private static void OnConnectionClosed(ConnectionClosedArgs obj)
 {
     Console.WriteLine("Connection closed!");
 }
示例#3
0
        /// <summary>
        /// Disconects the given client
        /// </summary>
        /// <param name="cl">Client</param>
        public void StopClient(ConnectedClient cl)
        {
            try
            {
                cl.client.Close();
            }
            catch { }

            try
            {
                ConnectionClosedArgs cca = new ConnectionClosedArgs(cl);
                ConnectionClosed(this, cca);
            }
            catch { }
        }