private void ClientInitialized(Object source, EventArgs e) { TelnetClient client = (TelnetClient)source; // Send ASCII FF + BS and ANSI Clear Screen + Banner client.Write("\u000c\u0008\u001B[2J\r\u001B[0;33mTWX Proxy 3 - Version 3.1944a Alpha - Please do not distribute.\n\r\n\r"); // Send Greeting BroadCast($"\u001B[1;31mConnection accepted from {client.RemoteEP.Address}({client.ReverseDNS})\n\r\n\r"); }
private async Task HandleConnectionsAsync(TcpListener listener) { while (active) { // Wait for connections. TelnetClient client = new TelnetClient(await listener.AcceptTcpClientAsync()); // Add the receive handler. client.Initialized += ClientInitialized; client.Receive += OutboundReceive; client.Disconnected += ClientDisconnect; // Add the client to the list of clients Clients.Add(client); // Raise client connected event. ClientConnected(client, new EventArgs()); //Handle New connection //NewClient(client); } }
private void ClientDisconnect(Object source, EventArgs e) { TelnetClient client = (TelnetClient)source; BroadCast($"\u001B[1;31mClient disconnected {client.RemoteEP.Address}({client.ReverseDNS})\n\r\n\r"); }