private static 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)) { receiver.ReceivePacket(packet.PayloadData); } }
private static void PacketHandler(object sender, CaptureEventArgs e) { try { var packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data).Extract <UdpPacket>(); if (packet != null && (packet.SourcePort == 5056 || packet.DestinationPort == 5056)) { _receiver.ReceivePacket(packet.PayloadData); } } catch (Exception ex) { Log.Error(nameof(StartDeviceCapture), ex); _mainWindowViewModel.SetErrorBar(Visibility.Visible, LanguageController.Translation("PACKET_HANDLER_ERROR_MESSAGE")); _mainWindowViewModel.StopTracking(); } }
private static void PacketHandler(object sender, CaptureEventArgs e) { try { var packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data).Extract <UdpPacket>(); if (packet != null && (packet.SourcePort == 5056 || packet.DestinationPort == 5056)) { _receiver.ReceivePacket(packet.PayloadData); } } catch (OverflowException ex) { ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod().DeclaringType, ex); Log.Error(nameof(PacketHandler), ex); } catch (Exception exc) { ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod().DeclaringType, exc); Log.Error(nameof(PacketHandler), exc); } }
private void Udp_OnData(Datagram datagram) { _receiver.ReceivePacket(datagram.Data); }