Im using
pcap_next_ex();
to get the next packet.
I tried to search for getting the last previous packet but I couldn't find such function.
if someone know if it is possible to get the last previous packet it will be very helpful.
thanks!
The pcap library reads only the next packet from the underlying handle, and with some inputs (like capturing of live traffic) it would not even be possible to get back. If you need to go back within a pcap stream you need to implement your own buffering of packets previously read with pcap_next* .