Example #1
0
 public static void HandlePacket(IPacket packet)
 {
     switch (packet.GetOpcode())
     {
     case PacketCode.SensorData:
         break;
     }
 }
Example #2
0
 public static void HandlePacket(IPacket packet)
 {
     switch (packet.GetOpcode())
     {
         case PacketCode.SensorData:
             break;
     }
 }
Example #3
0
        static void SendWhole(Socket sock, IPacket packet)
        {
            var stream = new MemoryStream();
            var writer = new BinaryWriter(stream);

            byte[] payload = packet.ToBytes();
            writer.Write((short)packet.GetOpcode());
            writer.Write(payload.Length);
            writer.Write(payload);

            sock.Send(stream.ToArray());
        }
Example #4
0
        static void SendPartial(Socket sock, IPacket packet)
        {
            var stream = new MemoryStream();
            var writer = new BinaryWriter(stream);

            byte[] payload = packet.ToBytes();
            writer.Write((short)packet.GetOpcode());
            writer.Write(payload.Length);
            writer.Write(payload);

            var data = stream.ToArray();
            Console.WriteLine(Utils.HexDump(data));
            sock.Send(data, 0, 8, 0);
            Thread.Sleep(100);
            sock.Send(data, 8, data.Length - 8, 0);
        }
Example #5
0
        static void SendPartial(Socket sock, IPacket packet)
        {
            var stream = new MemoryStream();
            var writer = new BinaryWriter(stream);

            byte[] payload = packet.ToBytes();
            writer.Write((short)packet.GetOpcode());
            writer.Write(payload.Length);
            writer.Write(payload);

            var data = stream.ToArray();

            Console.WriteLine(Utils.HexDump(data));
            sock.Send(data, 0, 8, 0);
            Thread.Sleep(100);
            sock.Send(data, 8, data.Length - 8, 0);
        }
Example #6
0
        static void SendWhole(Socket sock, IPacket packet)
        {
            var stream = new MemoryStream();
            var writer = new BinaryWriter(stream);

            byte[] payload = packet.ToBytes();
            writer.Write((short)packet.GetOpcode());
            writer.Write(payload.Length);
            writer.Write(payload);

            sock.Send(stream.ToArray());
        }