[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[OpenVerse] Server Broadcast Message
Guess it would have made more sense if I had actually sent the code with
that last email huh?
Here it is, and what I said previously still applies!!
<CODE>
#!/usr/bin/perl -w
use IO::Socket;
die "You need to specify a message to broadcast.\n" unless @ARGV;
# Create an array of servers:ports to send the broadcast to.
#servers = ("world.openverse.org:7000",
# "world.openverse.org:5190");
@servers = "datapex4.datapex.com:7001";
# Or if you'd rather have them all stored in a config file
# uncomment this and set one up using the same syntax as server.com:port
# with one server:port per line
#
# open (CONFIGFILE, "<servers.cfg" || die Error opening file\n $!");
# chomp;
# @servers = <CONFIGFILE>;
# close CONFIGFILE;
# Auth string to be sent to the server once the connection
# has been created.
$auth = "AUTH SrvrAdmin 50 50 default.gif 0 0 0 0 0";
# Yeah I'm a sub-function freak!
sub send_broadcast
{
foreach (@servers)
{
($server, $port) = split(/:/, $_);
$socket = IO::Socket::INET->new(PeerAddr => $server, PeerPort => $port, Proto => "tcp", Type => SOCK_STREAM);
print $socket "$auth\n";
print $socket "CHAT @ARGV\n";
close($socket);
}
}
&send_broadcast;
</CODE>
--
Brandon L. Griffith | Give me liberty or give me something
brandon@debian.org | of equal or lesser value from your
bgriffit@lexmark.com | glossy 32 page catalog.
blgriffith@openverse.org |
--------------------------------------------------------------------
The opinions expressed by the above named individual in no way are
representative of the faculty, janitors, small woodland animals, and
other gainfully employed people at Lexmark International.
--------------------------------------------------------------------
-----------------------------------------------------------------
To unsubscribe to the OpenVerse mailing list send a message
to openverse-request@openverse.org with the following word
in the BODY of the message.
UNSUBSCRIBE
If you need assistance from a human, email cruise@openverse.org
-----------------------------------------------------------------