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); } }
public void RaiseOnAliasChanged(TelnetClient C, string Old, string New) { if (OnAliasChanged != null) { OnAliasChanged(C, Old, New); } }
public void Disconnect(TelnetClient TC) { if (Clients.Contains(TC)) { Clients.Remove(TC); TC.ClientSocket.Disconnect(false); TC.ClientSocket.Dispose(); } }
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); } } }
public void RaiseOnAliasChanged(TelnetClient C, string Old, string New) { OnAliasChanged?.Invoke(C, Old, New); }