Пример #1
0
        public void Run()
        {
            IPEndPoint EndPoint = new IPEndPoint(IPAddress.Any, Port);

            ServerSocket.Bind(EndPoint);
            ServerSocket.Listen(0);

            Running = true;
            while (Running)
            {
                Socket       ClientSocket = ServerSocket.Accept();
                TelnetClient Client       = new TelnetClient(this, ClientSocket, DateTime.Now);
                lock (Clients)
                    Clients.Add(Client);

                // TODO: Better way
                Thread ClientThread = new Thread((C) => {
                    OnConnected?.Invoke((TelnetClient)C);
                    lock (Clients)
                        Clients.Remove((TelnetClient)C);
                });
                ClientThread.IsBackground = true;
                ClientThread.Start(Client);
            }
        }
Пример #2
0
 public void RaiseOnAliasChanged(TelnetClient C, string Old, string New)
 {
     if (OnAliasChanged != null)
     {
         OnAliasChanged(C, Old, New);
     }
 }
Пример #3
0
 public void Disconnect(TelnetClient TC)
 {
     if (Clients.Contains(TC))
     {
         Clients.Remove(TC);
         TC.ClientSocket.Disconnect(false);
         TC.ClientSocket.Dispose();
     }
 }
Пример #4
0
        public void Run()
        {
            IPEndPoint EndPoint = new IPEndPoint(IPAddress.Any, Port);

            ServerSocket.Bind(EndPoint);
            ServerSocket.Listen(0);

            Running = true;
            while (Running)
            {
                Socket       ClientSocket = ServerSocket.Accept();
                TelnetClient Client       = new TelnetClient(this, ClientSocket, DateTime.Now);
                Clients.Add(Client);

                if (OnConnected != null)
                {
                    OnConnected(Client);
                }
            }
        }
Пример #5
0
 public void RaiseOnAliasChanged(TelnetClient C, string Old, string New)
 {
     OnAliasChanged?.Invoke(C, Old, New);
 }