Skip to content

Instantly share code, notes, and snippets.

@chrisaycock
chrisaycock / pcap_udp.cpp
Last active October 12, 2024 21:01
Example for accessing UDP packets in a pcap file
// answer to https://quant.stackexchange.com/q/55088/35
// compile with c++ pcap_udp.cpp -lpcap
#include <iostream>
#include <pcap/pcap.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/udp.h>