wildnature has asked for the wisdom of the Perl Monks concerning the following question:

hi everyone: i am coping with tcp streams captured in my computer with perl. i create a hash structure and the packets within save stream are added to hash node. but i don't know how to make these packets of one tcp stream wrote into a single pcap file. it seems that Net::Pcap can only handle this by one packet. does anyone know of it ? thanks a lot :)

Replies are listed 'Best First'.
Re: Got a question when write pcap files
by Illuminatus (Curate) on Jan 13, 2011 at 14:32 UTC
    perhaps you could provide a pared-down code sample for how you are getting the data into the hash (remember to use <code> tags). While the Net::pcap::pcap_dump function writes a single packet, it is similar to a print to an open file -- you can write as many packets as you want, just one at a time.

    fnord

      thanks a lot

      i decide to use tool of 'dumpcap' to write file, that may be more efficient :)