Example (2)

This program searches and enumerate all the services that registered themselves on the network.


#!/usr/bin/perl
use strict;
use Net::Rendezvous;

my $services = Net::Rendezvous->enumerate_services;

print "Services found: \n";
for my $service ($services->entries) {
    printf "  %s/%s\t%s\n", $service->name, $service->protocol, $service->fqdn;
}

It produces the following output:


Services found:
  ssh/tcp       _ssh._tcp.local
  http/tcp      _http._tcp.local
  netbios-ns/udp        _netbios-ns._udp.local
  netbios-ssn/tcp       _netbios-ssn._tcp.local
  afpovertcp	_afpovertcp._tcp.local
  x11/tcp       _x11._tcp.local


YAPC::Europe 2004 28 / 36