Miscellany
public text v1 · immutable#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket::INET;
my $start = 8801;
my $max = 9000;
my @_fh = ();
for ( $start .. $max ) {
$_fh[$_] = IO::Socket::INET->new(
LocalPort => $_,
LocalAddr => 'localhost',
Proto => 'tcp',
Listen => SOMAXCONN
) or die "Couldn't bind to port $_ : $!\n";
}
sleep 60;
foreach my $fd ( @_fh ) { close( $fd ) }