Rendezvous... in Perl | Discovering your network neighbourhood |
Example (2) |
The following program searches machines that provide the afpovertcp
service (AppleTalk Filing Protocol over TCP) the file sharing service of Mac OS X.
#!/usr/bin/perl use strict; use Net::Rendezvous; my $ressource = new Net::Rendezvous 'afpovertcp'; $ressource->discover; for my $entry ($ressource->entries) { printf "%s (%s:%s) %s %s\n", $entry->name, $entry->address, $entry->port, $entry->fqdn } |
It produces the following output:
Jupiter (192.168.1.2:548) Jupiter._afpovertcp._tcp.local Luke (192.168.1.11:548) Luke._afpovertcp._tcp.local Eole (192.168.1.16:548) Eole._afpovertcp._tcp.local |
YAPC::Europe 2004 | 27 / 36 | |
Copyright © Sébastien Aperghis-Tramoni <sebastien@aperghis.net> |