On Tue, 1 May 2001, Karl J. Runge wrote:
> > Hey, all -- I'm trying to find a way to figure out what the temperature in
> > my data center is.  Preferably, I'd like a device that could be queried
> > via TCP, though serial would be acceptable.  Any suggestions?  
[...]
> I always wanted to get one of these:
> 
>       http://www.spiderplant.com/hlt/
> 
> but never got around to it. It comes with software and drivers for Unix.

Just a quick update: it works like a champ.  The docs are a little slim,
but if you look at the script file that accompanies the executables, all
becomes clear fairly quickly.  I munged some stuff from Camel, and came up
with the below as a quick-n-dir-T(tm) (and ugly) way to query via TCP:
(If you're lazy, you can just telnet to port 1234...)

Client:

#!/usr/bin/perl
use IO::Socket::INET;
$socket = IO::Socket::INET->new(PeerAddr => "temphost", #hostname address of "server"
                                PeerPort => "1234",
                                Proto    => "tcp",
                                Type     => SOCK_STREAM)
        or die "Coudln't connect to host or port: $!\n";
$temp = <$socket>;
chomp $temp;
print "The temperature is $temp F.\n";
close ($socket);

Server:

#!/usr/bin/perl
use IO::Socket::INET;
$socket = IO::Socket::INET->new(PeerAddr => "polaris",
                                PeerPort => "1234",
                                Proto    => "tcp",
                                Type     => SOCK_STREAM)
        or die "Coudln't connect to host or port: $!\n";
$temp = <$socket>;
chomp $temp;
print "The temperature is $temp F.\n";
close ($socket);


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to