private void PacketHandler(object sender, CaptureEventArgs e) { UdpPacket packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data).Extract <UdpPacket>(); if (packet != null && (packet.SourcePort == 5056 || packet.DestinationPort == 5056)) { photonParser.ReceivePacket(packet.PayloadData); } }
private void PacketHandler(Packet packet) { IpV4Datagram ip = packet.Ethernet.IpV4; UdpDatagram udp = ip.Udp; if (udp == null || (udp.SourcePort != 5056 && udp.DestinationPort != 5056)) { return; } photonParser.ReceivePacket(udp.Payload.ToArray()); }
private void PacketHandler(Packet packet) { IpV4Datagram ip = packet.Ethernet.IpV4; UdpDatagram udp = ip.Udp; if (udp == null || (udp.SourcePort != 5056 && udp.DestinationPort != 5056 && udp.SourcePort != 5055 && udp.DestinationPort != 5055)) { return; } try { photonParser.ReceivePacket(udp.Payload.ToArray()); } catch (Exception e) { // Don't crash when we can't parse the packet Console.WriteLine(e); } }