Beispiel #1
0
        /* Getters & Setters */

        /* Callback Methods
        ** Syntaxe : When{TypePacket}
        */
        protected void WhenMessage(PacketHeader header, Connection connection, Packet00Message packet)
        {
            string str = header.PacketType.ToString();

            Console.WriteLine(str);
            Console.WriteLine("\nA message was received from " + connection.ToString() + " which said '" + packet.Message + "'.");
        }
        protected void WhenPing(PacketHeader header, Connection connection, Packet00Message packet)
        {
            Packet00Message answer = new Packet00Message();

            answer.Message = "Hello client ! ";
            connection.SendObject <Packet00Message>("Ping", answer);
        }
        /* Callback Methods
        ** Syntaxe : When{TypePacket}
        */
        protected void WhenMessage(PacketHeader header, Connection connection, Packet00Message packet)
        {
            string          str    = header.PacketType.ToString();
            Packet00Message answer = new Packet00Message()
            {
                Message = "Hello client ! "
            };

            //answer.message = "Hello client ! ";
            Console.WriteLine(str);
            Console.WriteLine("\nA message was received from " + connection.ToString() + " which said '" + packet.Message + "'.");

            connection.SendObject <Packet00Message>("Message", answer);
        }
Beispiel #4
0
        public void Ping()
        {
            Packet00Message ping = new Packet00Message();

            ping.Message = "PING";
            try
            {
                NetworkComms.SendObject <Packet00Message>("Ping", serverInfo.Ip, serverInfo.Port, ping);
            }
            catch (CommsException e)
            {
                throw e;
            }
            Console.WriteLine("Ping sended");
        }
Beispiel #5
0
 protected void WhenPing(PacketHeader header, Connection connection, Packet00Message packet)
 {
     client.Login();
 }