Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Syntactic Confectionery Delight
 
PerlMonks  

Net::Pcap does not work

by arc_of_descent (Hermit)
on Jul 24, 2002 at 06:59 UTC ( [id://184767]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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


Hi Monks,
I recently downloaded and compiled the Net::Pcap module.
But the tests don't seem to work.
I tried the script, 04-loop.t in the tests directory
, but it just sits there in a loop.
Is this expected, or is there something wrong?

Thanx

--
arc_of_descent

Replies are listed 'Best First'.
Re: Net::Pcap does not work
by rob_au (Abbot) on Jul 24, 2002 at 07:19 UTC
    The 04-loop.t test script for Net::Pcap can take a moment or two to complete - This script creates a Net::Pcap object which, using the loop method, listens for ten packets on the network interface returned by lookupdev method of this module and the underlying libpcap library. If your network is nascent, this process may take some time - It may be worthwhile to start an FTP download or alike in the background to generate the necessary network traffic for the loop method and underlying libpcap library to capture.

    The loop method of the Net::Pcap library is described in my tutorial on this module here.

     

      Hi,
      Thanx for the link to the tutorial
      I had a brief look at it and will study it further.
      But unfortunately, the loop method does
      not work even after i started some heavy downloads, etc
      Is there something wrong with my libpcap installation?
      Does tcpdump use libpcap? cause my tcpdump works fine

      --
      arc_of_descent

        Yes, libpcap is underneath tcpdump as well as being the basis for Net::Pcap. Could it be that your interface is not in promiscuious mode? Newer versions of tcpdump do not put the interface into permiscuous mode by default, if this behavior is inherited from libpcap, you may have to manually put the interace into permiscuous mode. Also make sure you're explicitly telling Net::Pcap which interface you want it to listen to. Permissions can also be a problem with pcap, in many cases the program using it has to run with root permissions.
Re: Net::Pcap does not work
by arc_of_descent (Hermit) on Jul 24, 2002 at 09:11 UTC
    HI

    Well i just found the problem
    I installed Net::Pcap on a machine with
    libpcap version 0.6 and it works great!
    I have version 0.4
    Looks like i have to upgrade my libpcap
    Is this quirk(?) documented?

    --
    arc_of_descent

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://184767]
Approved by wil
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.