Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  NET::FRAME::DUMP::ONLINE2 (3)

.ds Aq ’


Net::Frame::Dump::Online2 - tcpdump like implementation, online mode and non-blocking



   use Net::Frame::Dump::Online2;

   # Simply create a Dump object
   my $oDump = Net::Frame::Dump::Online2->new(
      dev => eth0,


   # Gather frames
   while (1) {
      if (my $f = $oDump->next) {
         my $raw            = $f->{raw};
         my $firstLayerType = $f->{firstLayer};
         my $timestamp      = $f->{timestamp};


   # Default parameters on creation
   my $oDumpDefault = Net::Frame::Dump::Online2->new(
      timeoutOnNext => 3,
      timeout       => 0,
      promisc       => 0,
      snaplen       => 1514,
      file          => ,
      overwrite     => 0,


This module implements a tcpdump-like program, for live capture from networks.


<B>devB> The network interface to listen on. No default value.
<B>timeoutOnNextB> Each time you call <B>nextB> method, an internal counter is updated. This counter tells you if you have not received any data since <B>timeoutOnNextB> seconds. When a timeout occure, <B>timeoutB> is set to true.
<B>timeoutB> When <B>timeoutOnNextB> seconds has been reached, this variable is set to true, and never reset. See <B>timeoutResetB> if you want to reset it.
<B>snaplenB> If you want to capture a different snaplen, set it a number. Default to 1514.
<B>promiscB> By default, interface is not put into promiscuous mode, set this parameter to true if you want it.
The following are inherited attributes:
<B>filterB> Pcap filter to use. Default to no filter.
<B>firstLayerB> Stores information about the first layer type contained on read frame. This attribute is filled only after a call to <B>startB> method.
<B>isRunningB> Returns true if a call to <B>startB> has been done, false otherwise or if a call to <B>stopB> has been done.
<B>keepTimestampB> Sometimes, when frames are captured and saved to a .pcap file, timestamps sucks. That is, you send a frame, and receive the reply, but your request appear to have been sent after the reply. So, to correct that, you can use <B>Net::Frame::DumpB> own timestamping system. The default is 0. Set it manually to 1 if you need original .pcap frames timestamps.


<B>newB> (hash) Object constructor. You can pass attributes that will overwrite default ones. See <B>SYNOPSISB> for default values.
<B>startB> When you want to start reading frames from network, call this method.
<B>stopB> When you want to stop reading frames from network, call this method.
<B>nextB> Returns the next captured frame; undef if none awaiting. Each time this method is called, a comparison is done to see if no frame has been captured during <B>timeoutOnNextB> number of seconds. If so, <B>timeoutB> attribute is set to 1 to reflect the pending timeout.
<B>storeB> (<B>Net::Frame::SimpleB> object) This method will store internally, sorted, the <B>Net::Frame::SimpleB> object passed as a single parameter. <B>getKeyB> methods, implemented in various <B>Net::Frame::LayerB> objects will be used to efficiently retrieve (via <B>getKeyReverseB> method) frames.

Basically, it is used to make <B>recvB> method (from <B>Net::Frame::SimpleB>) to retrieve quickly the reply frame for a request frame.

<B>getFramesForB> (<B>Net::Frame::SimpleB> object) This will return an array of possible reply frames for the specified <B>Net::Frame::SimpleB> object. For example, reply frames for a UDP probe will be all the frames which have the same source port and destination port as the request.
<B>flushB> Will flush stored frames, the one which have been stored via <B>storeB> method.
<B>timeoutResetB> Reset the internal timeout state (<B>timeoutB> attribute).
<B>getStatsB> Tries to get packet statistics on an open descriptor. It returns a reference to a hash that has to following fields: <B>ps_recvB>, <B>ps_dropB>, <B>ps_ifdropB>.




Patrice <GomoR> Auffret


Copyright (c) 2006-2014, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.

Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 NET::FRAME::DUMP::ONLINE2 (3) 2014-12-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.