I am using WireShark to analyse the network traffic. After saving traffic in a .pcap file and I need to analyse it using JNetPCAP API.
There is some way to know the numbers of packets contained in the pcap file?
Sample Code:
final String FILENAME = "/home/pcap1.pcap";
final StringBuilder errbuf = new StringBuilder();
final Pcap pcap = Pcap.openOffline(FILENAME, errbuf);
if (pcap == null) {
System.err.println(errbuf);
return;
}
pcap.loop(/*I WANT TO KNOW NUMBER OF PACKETS HERE!!!!*/ 10, new JPacketHandler<StringBuilder>() {
//SOME CODE
}
}