public static void ProcessPacket(byte[] data, IPEndPoint ep) { StringBuilder sb = new StringBuilder(); foreach (byte b in data) { sb.Append(b.ToString("X2") + " "); } QPacket p = new QPacket(data); WriteLog(5, "received : " + p.ToStringShort()); WriteLog(10, "received : " + sb.ToString()); WriteLog(10, "received : " + p.ToStringDetailed()); QPacket reply = null; ClientInfo client = null; if (p.type != QPacket.PACKETTYPE.SYN) { client = Global.GetClientByIDrecv(p.m_uiSignature); } switch (p.type) { case QPacket.PACKETTYPE.SYN: reply = QPacketHandler.ProcessSYN(p, ep, out client); break; case QPacket.PACKETTYPE.CONNECT: if (client != null) { reply = QPacketHandler.ProcessCONNECT(client, p); } break; case QPacket.PACKETTYPE.DATA: RMC.HandlePacket(listener, p); break; case QPacket.PACKETTYPE.DISCONNECT: if (client != null) { reply = QPacketHandler.ProcessDISCONNECT(client, p); } break; case QPacket.PACKETTYPE.PING: if (client != null) { reply = QPacketHandler.ProcessPING(client, p); } break; } if (reply != null && client != null) { Send(reply, client); } }
public static void ProcessPacket(byte[] data, IPEndPoint ep) { QPacketHandler.ProcessPacket("UDP Redirector", data, ep, listener, UDPMainServer.serverPID, UDPMainServer.listenPort); }