PcapHandle.nextEx

int nextEx(out const(pcap_pkthdr) * header, out const(ubyte) * data)

Reads the next packet from the handle.

WARNING: The returned header and data pointers point into libpcap's internal buffer and are only valid until the next call to nextEx, loop, dispatch, or any other libpcap read function on this handle. If you need the data to survive across calls, copy it immediately.

Parameters

headerPointer to receive the packet header.
dataPointer to receive the packet data.

Returns

1 if the packet was read successfully.

0 if packets are being read from a live capture and the timeout expired. -1 if an error occurred. -2 if EOF was reached (for offline captures).