use strict; use warnings; use IO::Socket::INET; $|++; my $port = getservbyname 'bootps', 'udp'; print "Listening on UDP port: $port\n"; my $socket = IO::Socket::INET -> new ( LocalPort => $port, Broadcast => 1, Proto => 'udp', Blocking => 1 ) or die "Failed to bind to socket: $@"; my $mess; while ($socket -> recv ($mess, 1024)) { print "Saw: \n$mess\n"; }