Example #1
0
        void session_DisconnectHandler(object sender, EventArgs e)
        {
            Console.WriteLine("Session Disconnecting: {0}", sender);
            SOCKSServerSession session = sender as SOCKSServerSession;

            lock (SessionLock)
            {
                if (Sessions.Contains(session) == true)
                {
                    Sessions.Remove(session);
                }
            }
        }
Example #2
0
        void Listener_OnNewConnection(System.Net.Sockets.Socket s)
        {
            Console.WriteLine("Session Connecting: {0}", s);
            SOCKSServerSession session = new SOCKSServerSession(s, this);

            lock (SessionLock)
            {
                Sessions.Add(session);
            }

            session.DisconnectHandler += new SocketClient.SocketEventHandler(session_DisconnectHandler);
            session.Start();
        }