I am trying to learn how to use PCAP libraries. So started on my windows Vista Enterprise laptop with wireless connection. No wired connection on the PC. To start with i want to get the network IPAddress and subnet mask. Eventually able to build the programme by cut&paste from all the perl experts articles:
use Net::Pcap; my $dev = Net::Pcap::lookupdev( \$err ); if ( defined $err ) { die "Unable to determine network device for monitoring - ", $err; } @devs = Net::Pcap::findalldevs(\$err); foreach (@devs) { $dev= $_ ; print "$_ \n"; my ( $addr, $net, $mask ); if ( Net::Pcap::lookupnet( $dev, \$net, \$mask, \$err ) ) {die "Unable to look up device information for ", $dev, " - " +, $err; } print "Device : $dev, Network Address : $net, NetMask : $mask \n" +; }
And the output is: ------------------
C:\Perl\Data>..\bin\perl Pcap-102.pl \Device\NPF_{A6DECF92-8A65-40B8-BFDC-214D19DA6F37} Device : \Device\NPF_{A6DECF92-8A65-40B8-BFDC-214D19DA6F37}, Network A +ddress : 2604000768, NetMask : 4294967040 \Device\NPF_{8A8505C7-56D7-4D83-B18E-85957B77C060} Device : \Device\NPF_{8A8505C7-56D7-4D83-B18E-85957B77C060}, Network A +ddress : 3232238080, NetMask : 4294967040 \Device\NPF_{B44D4BF3-170A-4772-BF08-B03EB1739C5C} Device : \Device\NPF_{B44D4BF3-170A-4772-BF08-B03EB1739C5C}, Network A +ddress : 0, NetMask : 0 \Device\NPF_{691970A7-D403-46AD-BC01-1628915ED58A} Device : \Device\NPF_{691970A7-D403-46AD-BC01-1628915ED58A}, Network A +ddress : 0, NetMask : 4278190080 C:\Perl\Data>
----------------- While my actual Wireless network adapter settings on the PC are:
Wireless LAN adapter Wireless Network Connection: Connection-specific DNS Suffix . : hsd1.ca.comcast.net. Description . . . . . . . . . . . : Intel(R) WiFi Link 5300 AGN Physical Address. . . . . . . . . : 00-21-6A-17-F1-56 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::11f2:d913:3057:da24%13(Pr +eferred) IPv4 Address. . . . . . . . . . . : 192.168.10.103(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : Tuesday, January 01, 2013 8:20: +58 PM Lease Expires . . . . . . . . . . : Wednesday, January 02, 2013 2:3 +3:19 AM Default Gateway . . . . . . . . . : 192.168.10.1 DHCP Server . . . . . . . . . . . : 192.168.10.1 DHCPv6 IAID . . . . . . . . . . . : 234889578 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-11-D6-E3-9D-00-25-B +3-2E-25-5A DNS Servers . . . . . . . . . . . : 202.148.200.3 NetBIOS over Tcpip. . . . . . . . : Enabled
---------------

Is not the function call "lookupdev" supposed to find the active Network adapter?

Is not the wireless adapter, part of the "findalldevs()" ?

Does windows OS need different PCAP functions?

I did read couple of similar questions but answers not in full. Thought may be i should post the question again.

Thanks Simbha


In reply to Windows Wireless and PCAP library functions. by Simbha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.