Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Answer: List all network interfaces on the local machine?

by rob_au (Abbot)
on May 15, 2002 at 06:12 UTC ( #166653=categorized answer: print w/replies, xml ) Need Help??

Q&A > network programming > List all network interfaces on the local machine? - Answer contributed by rob_au

For *NIX-type platforms, there is the IO::Interface module which allows local interfaces to be enumerated via additional methods added to IO::Socket objects. These methods allow interface information to be both retrieved and modified.

For example ...

use IO::Interface; use IO::Socket; my $sock = IO::Socket::INET->new( 'Proto' => 'udp' ); foreach my $iface ( $sock->if_list ) { print $iface, " ", $sock->if_addr, "/", $sock->if_netmask, "\n"; }

Log In?

What's my password?
Create A New User
choroba notices a missing "C"
[LanX]: horoba?
[marto]: Rocks (YouTubes warning)
[Corion]: Your Mother: Better than Roc hunting, I guess :)
LanX WTF. Gernany beat Canada in ice hockey
[LanX]: Not fair ... I'm totally ignoring the doping games...
[Corion]: Huh? That's weird indeed... Also, I thought that the olympic games were over already, but obviously not ;)
[choroba]: And we lost to unknown sportspersons with no official dresses
[choroba]: Russia didn't send them officially, they're on vacation in Korea
[LanX]: no that was Syria! ;-)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2018-02-23 16:22 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (303 votes). Check out past polls.