Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Perl and Net::Pcap

by rob_au (Abbot)
on May 31, 2002 at 07:57 UTC ( #170648=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    $dev = Net::Pcap::lookupdev(\$err)
  2. or download this
    use Net::Pcap;
    use strict;
        die 'Unable to determine network device for monitoring - ', $err;
  3. or download this
    Net::Pcap::lookupnet($dev, \$net, \$mask, \$err)
  4. or download this
    my ($address, $netmask, $err);
    if (Net::Pcap::lookupnet($dev, \$address, \$netmask, \$err)) {
    print STDOUT "$dev: addr/mask -> $addr/$mask\n";
  5. or download this
    $object = Net::Pcap::open_live($dev, $snaplen, $promisc, $to_ms, \$err
  6. or download this
    Net::Pcap::loop($object, $count, \&callback_function, $user_data)
  7. or download this
    sub callback_function {
        my ($user_data, $header, $packet) = @_;
  8. or download this
    Net::Pcap::compile($object, \$filter_compiled, $filter_string, $optimi
    +se, $netmask)
  9. or download this
    Net::Pcap::setfilter($object, $filter_compiled);
  10. or download this
  11. or download this
    use Net::Pcap;
    use NetPacket::Ethernet;
            $ip->{'dest_ip'}, ":", $tcp->{'dest_port'}, "\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://170648]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2015-11-28 07:14 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (739 votes), past polls