Slow Send Speed

I am able to send about 15kpps (thousand packets per second), and that uses up about 25 mb/s for what I am using it for. Changing the bandwidth has no effect on the pps unless I approach my 1gbps limit.

I am running JNetPcap 1.3.0 on Windows 8.1. My program only uses 5% of the CPU, leaves 12GB ram free, no noticeable disk I/O, and there is a 1gbps line.

The code I am using is very basic, taken from the example and ran in a loop. b in this case is a bytebuffer of a valid packet, and returns 0 each time.

int snaplen = 0;
int flags = Pcap.MODE_NON_BLOCKING;
int timeout = 0;
Pcap pcap = Pcap.openLive(device.getName(), snaplen, flags, timeout, errbuf);

for(int i=0; i<packetCount; i++) {

I have tried multi-threading, which had no effect on the pps. I noticed that the sendPacket method does return an integer after the packet has been sent, so the method itself might be blocking execution.

help with JFlowMap

hi in JFlowMap example the data return like this


superFlowMap::total packet count=418
total flow count=18

flow[0] -> Tcp fw/rev/tot pkts=[9/10/19],
flow[1] -> Tcp fw/rev/tot pkts=[9/11/20],
flow[2] -> Tcp fw/rev/tot pkts=[1/0/1],
flow[3] -> Tcp fw/rev/tot pkts=[6/6/12],
flow[4] -> Tcp fw/rev/tot pkts=[6/6/12],
flow[5] -> Tcp fw/rev/tot pkts=[5/5/10],
flow[6] -> Tcp fw/rev/tot pkts=[6/6/12],
flow[7] -> Tcp fw/rev/tot pkts=[5/5/10],
flow[8] -> Ip4 tot pkts=[18],
flow[9] -> Tcp fw/rev/tot pkts=[1/1/2],
flow[10] -> Tcp fw/rev/tot pkts=[74/135/209],
flow[11] -> Tcp fw/rev/tot pkts=[9/6/15],
flow[12] -> Tcp fw/rev/tot pkts=[8/6/14],
flow[13] -> Tcp fw/rev/tot pkts=[8/6/14],
flow[14] -> Tcp fw/rev/tot pkts=[6/6/12],
flow[15] -> Tcp fw/rev/tot pkts=[6/6/12],
flow[16] -> Tcp fw/rev/tot pkts=[6/6/12],
flow[17] -> Tcp fw/rev/tot pkts=[8/6/14],

i want understand what this part exactly mean fw/rev/tot pkts=[9/6/15]?

Converting a bytes[] to a pcap file


I currently have java code that is reading DatagramPackets from a MulticastSocket

Code follows the below pattern -

MulticastSocket socket = new MulticastSocket(PORT);

I then have a read() method which I continuously poll -

public void read() throws IOException {
byte[] buffer = new byte[65 * 1024];
DatagramPacket recv = new DatagramPacket(buffer, buffer.length);
try {
} catch (SocketTimeoutException ignore) {

byte[] byteData = recv.getData();


I now want to load this byteData into a PcapPacket object to eventually write to a pcap file. I tried doing the following -

PcapPacket pcapPacket = new PcapPacket(byteData);

but I get an error -java.lang.IndexOutOfBoundsException: Invalid [200,1380930833,1380930633) range.

I'm completely new to Jnetpcap - so any guidance would be much appreciated.

How to read full pcap file

for creating loop in jnetpcap we use-

pcap.loop(10, jpacketHandler, "jNetPcap rocks!");

This will run loop for 10 times to read 10 packets from pcap file
I want to run this loop to read pcap file till EOF (end of file).
What modification do I need to make in the loop ?

First timer

Syndicate content