All pastes #186359 Raw Edit

Something

public text v1 · immutable
#186359 ·published 2006-09-29 20:47 UTC
rendered paste body
#!/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 $start : $!\n";
}

sleep 60;

foreach my $fd ( @_fh ) { close( $fd ) }