예제 #1
0
        private static void SendReplyPacket(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client, RMCPacketReply reply, bool useCompression)
        {
            QPacket np = new QPacket(p.toBuffer());

            np.flags = new List <QPacket.PACKETFLAG>()
            {
                QPacket.PACKETFLAG.FLAG_NEED_ACK
            };
            np.m_oSourceVPort      = p.m_oDestinationVPort;
            np.m_oDestinationVPort = p.m_oSourceVPort;
            np.m_uiSignature       = client.IDsend;
            np.uiSeqId++;
            MemoryStream m = new MemoryStream();

            Helper.WriteU8(m, (byte)rmc.proto);
            Helper.WriteU8(m, 0x1);
            Helper.WriteU32(m, rmc.callID);
            Helper.WriteU32(m, rmc.methodID | 0x8000);
            byte[] buff = reply.ToBuffer();
            m.Write(buff, 0, buff.Length);
            buff = m.ToArray();
            m    = new MemoryStream();
            Helper.WriteU32(m, (uint)buff.Length);
            m.Write(buff, 0, buff.Length);
            np.payload     = m.ToArray();
            np.payloadSize = (ushort)np.payload.Length;
            WriteLog("send response packet");
            Send(udp, np, client);
            WriteLog("Response Data Content : \n" + reply.ToString());
        }
예제 #2
0
        public static void Send(QPacket p, ClientInfo client)
        {
            byte[]        data = p.toBuffer();
            StringBuilder sb   = new StringBuilder();

            foreach (byte b in data)
            {
                sb.Append(b.ToString("X2") + " ");
            }
            Log.WriteLine("[UDP] send : " + sb.ToString());
            Log.WriteLine("[UDP] send : " + p);
            listener.Send(data, data.Length, client.ep);
        }
예제 #3
0
        public static void Send(UdpClient udp, QPacket p, ClientInfo client)
        {
            byte[]        data = p.toBuffer();
            StringBuilder sb   = new StringBuilder();

            foreach (byte b in data)
            {
                sb.Append(b.ToString("X2") + " ");
            }
            WriteLog(5, "send : " + p.ToStringShort());
            WriteLog(10, "send : " + sb.ToString());
            WriteLog(10, "send : " + p.ToStringDetailed());
            udp.Send(data, data.Length, client.ep);
        }
예제 #4
0
        public static void Send(QPacket p, ClientInfo client)
        {
            byte[]        data = p.toBuffer();
            StringBuilder sb   = new StringBuilder();

            foreach (byte b in data)
            {
                sb.Append(b.ToString("X2") + " ");
            }
            WriteLog("send : " + sb.ToString(), !Global.useDetailedLog);
            WriteLog("send : " + p.ToStringDetailed(), !Global.useDetailedLog);
            WriteLog("send : " + p.ToStringShort(), Global.useDetailedLog);
            listener.Send(data, data.Length, client.ep);
        }
예제 #5
0
        private static void SendACK(UdpClient udp, QPacket p, ClientInfo client)
        {
            QPacket np = new QPacket(p.toBuffer());

            np.flags = new List <QPacket.PACKETFLAG>()
            {
                QPacket.PACKETFLAG.FLAG_ACK
            };
            np.m_oSourceVPort      = p.m_oDestinationVPort;
            np.m_oDestinationVPort = p.m_oSourceVPort;
            np.m_uiSignature       = client.IDsend;
            np.payload             = new byte[0];
            np.payloadSize         = 0;
            WriteLog(10, "send ACK packet");
            Send(udp, np, client);
        }