Hi Mark,
In our program using Jnetpcap, Some of the packets are lost while using
pcap.loop(-1, handler, "jNetPcap rocks!");
Our requirement is to capture all the packets from n/w card and write the payload to file.
The following is our code snippet
PcapPacketHandler handler = new PcapPacketHandler() {
public void nextPacket(PcapPacket packet, String user) {
pktdata = packet.getHeader(new Tcp());
if(pktdata != null && pktdata.getPayloadLength()>0)
fos.write(pktdata.getPayload());
}
}
We simulate 1MBps throughput and capture the packets thro jnetpcap program as well as wireshark. We found lot of packet are lost while compare to wireshark.
Kindly help us to resolve the problem and explain how loop method works(will it continue to read new arrival of packets from kernel buffer) while packethandler(nextpacket()) is processing the available packets in Jscanner.
Thanks in Advance,
Shyamala