in reply to Perl Script to Test Telnet Connectivity

If your intention is to simply determine if or not TCP opens on a port (i.e. you don't care about the protocol being transmitted on TCP), this can be done simply with TCP Ping (which just establishes TCP and then closes the connection).

Example:

use AnyEvent::Ping::TCP; my $t = tcp_ping '10.0.0.2', 1235; my $result = defined $t ? "OK" : "Failed"; print $result."\n";

Replies are listed 'Best First'.
Re^2: Perl Script to Test Telnet Connectivity
by redapplesonly (Sexton) on Nov 09, 2022 at 18:23 UTC

    This is a great chunk of code! Unfortunately, I couldn't install the module thanks to our company firewll, but I'm saving this to my notes nonetheless. Much appreciated!