public ClientTcp() { client = new SimpleTcpClient(1024, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 11000)); client.OnException += Client_OnException; client.OnReceivedMessage += Client_OnReceivedMessage; client.Start(); }
private void Listener_OnConnectionAccepted(object sender, NewConnectionArgs e) { Console.WriteLine("[TCPServer] New client connected"); SimpleTcpClient newClient = new SimpleTcpClient(1024, e.Client); newClient.OnException += NewClient_OnException; newClient.OnReceivedMessage += NewClient_OnReceivedMessage; newClient.OnDisconnect += NewClient_OnDisconnect; newClient.Start(); connectedClients.Add(newClient); }
private async void Listener_OnConnectionAccepted(object sender, NewConnectionArgs e) { Console.WriteLine("[TCPServer] New client connected"); SimpleTcpClient newClient = new SimpleTcpClient(1024, e.Client); newClient.OnException += NewClient_OnException; newClient.OnReceivedMessage += NewClient_OnReceivedMessage; newClient.Start(); await newClient.SendAsync(Encoding.ASCII.GetBytes("Hello I'm your server :D")); connectedClients.Add(newClient); }