I'm trying to implement a network sniffer using JPCap library.
The problem is, it is capturing only UDP packets of other nodes. The TCP packets are not being captured. (Actually TCP packets of my computer ONLY are being sniffed)
This is the code I'm using:
captor=JpcapCaptor.openDevice(interfaceList[interfaceNumber], 65535, true, 20);
captor.setFilter("ip and tcp",true);
JpcapWriter writer=JpcapWriter.openDumpFile(captor,"pass.txt");
for(int i=0;i<10;i++){
//capture a single packet
Packet packet=captor.getPacket();
//save it into the opened file
writer.writePacket(packet);
}
writer.close();