1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <pcap.h> int main(void) { pcap_t *p; char errbuf[PCAP_ERRBUF_SIZE]; int fd; p = pcap_open_live(NULL, 1500, 1, 500, errbuf); if (!p) { printf("pcap_open_live failed !\n%s\n", errbuf); return 1; } fd = pcap_fileno(p); printf("OK\n"); }