Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You would have to structure the InputStream data so that it could be divided into packets. For example, if you're writing raw packet data to the stream, before each packet you would write a number giving the size of the packet, in bytes.

Then, when reading the stream and writing a pcap file, you would read the number first, and then read that number of bytes of packet data. You would also have to ensure, in each iteration of the loop, the buffer would have to have exactly that number of bytes, so that dumper.dumpRaw knows how many bytes are in the packet.

This probably means that you should allocate the packet buffer separately, for every packet, and allocate it so that it's exactly the size of the packet data.

Without doing that, your code will NOT work.