Exemplo n.º 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)
            {

            }
        }
Exemplo n.º 2
0
 public override void OnDisconnect(Extasys.Network.TCP.Client.Connectors.TCPConnector connector)
 {
     Console.WriteLine("Disconnected from server");
 }
Exemplo n.º 3
0
        public override void OnDataReceive(Extasys.Network.TCP.Client.Connectors.TCPConnector connector, Extasys.Network.DataFrame data)
        {
            string dataReceived = Encoding.ASCII.GetString(data.Bytes);

        }
Exemplo n.º 4
0
 public override void OnClientDisconnect(Extasys.Network.TCP.Server.Listener.TCPClientConnection client)
 {
     
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
0
 public override void OnDataReceive(Extasys.Network.UDP.Client.Connectors.UDPConnector connector, Extasys.Network.DatagramPacket packet)
 {
     Console.WriteLine(packet.ServerEndPoint.Address.ToString() + " : " + Encoding.Default.GetString(packet.Bytes));
 }