Copy a PcapPacket

No replies
mszeles
Offline
Joined: 03/17/2010

Hi,

Can you tell me how can I make a copy of a PcapPacket which holds everything in Java memory(or at least at some memory which won't be freed/overwritten)?
I've modified the Pcap.nextEx example to process the incoming packets and in some cases I have to store these packets. The problem is that in some cases the "packet.scan(id);" call makes my previously stored packets invalid. Somehow it overwrites the memory area belonging to the stored packet and the stored packet throws an exception whenever I call toString on it(it worked fine when I stored the packet). So I would like to prevent this behavior somehow.
Thanks in advance,
Miklos