Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The example-code is described as: "The following is an example of a multicast server.
Every 10 seconds it transmits the current time and the list of logged-in users to the local network
using multicast group 226.1.1.2, port 2000 (these are chosen arbitrarily)."
But when the users were logging in? Before $sock was created? Ant where and how could they have logged in?
Using google I couldn't even found sample code of others.#!/usr/bin/perl # server use strict; use IO::Socket::Multicast; use constant DESTINATION => '226.1.1.2:2000'; my $sock = IO::Socket::Multicast->new(Proto=>'udp',PeerAddr=>DESTINAT +ION); while (1) { my $message = localtime; $message .= "\n" . `who`; $sock->send($message) || die "Couldn't send: $!"; } continue { sleep 10; }
My target is a server program that collects data form its own sources (by pipes)
saves them into files and distribute them to several clients (or users) if there are any.
I have had a solution by using normal sockets and threads-shared, but after the threads-module was updated
it now stops as soon as the first client drops its connection.
Your help is highly appreciated, because this is source of my data..
Thanks a lot in advance,
Carl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: need Socket::Multicast-help
by samtregar (Abbot) on Jun 20, 2007 at 17:48 UTC | |
by Anonymous Monk on Jun 20, 2007 at 18:37 UTC | |
by samtregar (Abbot) on Jun 20, 2007 at 18:42 UTC |