programming-examples/perl/Network/Checking for an open port.pl

8 lines
156 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
# Finds an open port.
$port = 2345;
while (getservbyport($port, "tcp") ) {
$port++;
}
print "An open port number is $port\n";