Exemple #1
0
 public override void OnDataReceive(Extasys.Network.TCP.Server.Listener.TCPClientConnection sender, Extasys.Network.DataFrame data)
 {
     // Client sends data to server.
     // Reply the received data back to sender.
     byte [] bytes = new byte[data.Length + 1];
     Buffer.BlockCopy(data.Bytes, 0, bytes, 0, data.Length);
     bytes[data.Length] = (byte)((char)2);
     try
     {
         sender.SendData(bytes, 0, bytes.Length);
     }
     catch (ClientIsDisconnectedException ex)
     {
     }
     catch (OutgoingPacketFailedException ex)
     {
     }
     catch (Exception ex)
     {
     }
 }
Exemple #2
0
 public override void OnClientDisconnect(Extasys.Network.TCP.Server.Listener.TCPClientConnection client)
 {
 }
Exemple #3
0
 public override void OnClientConnect(Extasys.Network.TCP.Server.Listener.TCPClientConnection client)
 {
     client.Name = client.IPAddress.ToString(); // Set a name for this client if you want to.
     Console.WriteLine(client.IPAddress.ToString() + " connected.");
     Console.WriteLine("Total clients connected: " + this.CurrentConnectionsNumber);
 }