Help for this page

Select Code to Download


  1. or download this
    my $socket = IO::Socket::INET->new(
       Broadcast => 1, Blocking => 1, ReuseAddr => 1,
    ...
    $srcaddr = $socket->recv($data, 100, 0);
    die "recv: $!" if !defined($srcaddr);
    close $socket;
    
  2. or download this
    my $socket = IO::Socket::INET->new(
       Proto => 'udp', Type => SOCK_DGRAM,
    ...
    my $hishost = gethostbyaddr($ipaddr, AF_INET);
    print "Client $hishost/$port said $data\n";
    print "sent " . $scoket->send('Refresh', 0, $ip) . "\n";