public static void SendRequestPacket(UdpClient udp, QPacket p, RMCP rmc, ClientInfo client, RMCPResponse packet, bool useCompression, uint error) { MemoryStream m = new MemoryStream(); if ((ushort)rmc.proto < 0x7F) { Helper.WriteU8(m, (byte)((byte)rmc.proto | 0x80)); } else { Helper.WriteU8(m, 0xFF); Helper.WriteU16(m, (ushort)rmc.proto); } byte[] buff; if (error == 0) { Helper.WriteU32(m, rmc.callID); Helper.WriteU32(m, rmc.methodID); buff = packet.ToBuffer(); m.Write(buff, 0, buff.Length); } else { Helper.WriteU32(m, error); Helper.WriteU32(m, rmc.callID); } buff = m.ToArray(); m = new MemoryStream(); Helper.WriteU32(m, (uint)buff.Length); m.Write(buff, 0, buff.Length); QPacket np = new QPacket(p.toBuffer()); np.flags = new List <QPacket.PACKETFLAG>() { QPacket.PACKETFLAG.FLAG_NEED_ACK }; np.m_uiSignature = client.IDsend; MakeAndSend(client, np, m.ToArray()); }
public static void SendResponseWithACK(UdpClient udp, QPacket p, RMCP rmc, ClientInfo client, RMCPResponse reply, bool useCompression = true, uint error = 0) { WriteLog(2, "Response : " + reply.ToString()); string payload = reply.PayloadToString(); if (payload != "") { WriteLog(5, "Response Data Content : \n" + payload); } SendACK(udp, p, client); SendResponsePacket(udp, p, rmc, client, reply, useCompression, error); }