Exemplo n.º 1
0
        void Listener_OnNewConnection(System.Net.Sockets.Socket s)
        {
            Console.WriteLine("Session Connecting: {0}", s.RemoteEndPoint);
            SOCKSServerSession session = new SOCKSServerSession(s, this);
            session.SOCKSServerMode = SOCKSServerMode;
            lock (SessionLock)
            {
                Sessions.Add(session);
            }

            session.DisconnectHandler += new SocketClient.SocketEventHandler(session_DisconnectHandler);
            session.Start();
        }
Exemplo n.º 2
0
        public void CloseAndRemoveSession(SOCKSServerSession session)
        {
            try
            {
                session.Disconnect();
            }
            catch (Exception ex)
            {
            }

            lock (SessionLock)
            {
                if (Sessions.Contains(session) == true)
                    Sessions.Remove(session);
            }
        }