testport.pl



NAME

testport.pl <host> <port>


DESCRIPTION

Test connection on <port> against <host>.


COPYRIGHT

Copyright 2010 Etienne LEMEE <coding AT etilem DOT net>

This piece of code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


#!/usr/bin/perl -w

use strict;
use Net::Telnet;

@ARGV > 1 or die <<"USAGE";
$0 <host> <port>

test connection on <port> against <host>.
USAGE

my ($t, $h) = (new Net::Telnet (Telnetmode => 0), shift);
$t->open(Host => $h, Port => shift) and printf "%s => %s", $h, $t->getline;