File: server.pl

package info (click to toggle)
libio-socket-multicast-perl 1.12-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 148 kB
  • sloc: perl: 216; makefile: 2
file content (17 lines) | stat: -rwxr-xr-x 359 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

use strict;
use lib '../blib/lib','../blib/arch';
use IO::Socket::Multicast;

use constant DESTINATION => '226.1.1.2:2000';

my $sock = IO::Socket::Multicast->new(ReuseAddr=>1);

while (1) {
  my $message = localtime;
  $message .= "\n" . `who`;
  $sock->mcast_send($message,DESTINATION) || die "Couldn't send: $!";
} continue {
  sleep 5;
}