#!/usr/bin/perl -w
#####################################################################


require 5;
use strict;
require IO::Socket;

### Parse the command line options
###

my $machine = $ARGV[0];
my $port = $ARGV[1];
my $timeout = $ARGV[2];

my $proto = "tcp";

my $socket = IO::Socket::INET->new(PeerAddr => $machine,
                               PeerPort => $port,
                               Proto => $proto,
		       	       Timeout => $timeout
		       );
if ($socket) {
	#print "Server ",$machine," port ",$port," active\n";
	print "up\n";
}
else {
	print "down\n";
}
