#!/usr/bin/perl -w use strict; use IO::Socket; my $remoteip = "10.6.21.10"; my $port = "69"; my $proto = "udp"; my $disconn = 0; my $checkport = IO::Socket::INET->new( PeerAddr => "$remoteip", PeerPort => "$port", Proto => "$proto", Timeout => '0') or $disconn = 1; if ($disconn) { print " Port $port is down.\n"; } else { print " Port $port is up.\n"; } close $checkport;