All pastes #186351 Raw Edit

Anonymous

public text v1 · immutable
#186351 ·published 2006-09-29 20:37 UTC
rendered paste body
#!/usr/bin/perl

use strict;
use IO::Socket;

my $start = 8801;
my $max   = 9000;
my @_fh   = ();

for($start=$start;$start<$max;$max++) {
    $_fh[$start] = IO::Socket::INET->new(   LocalPort   =>  $start,
                                            LocalAddr   =>  'localhost',
                                            Proto       =>  'tcp',
                                            Listen      =>  SOMAXCONN)
                   or die "Couldn't open port $start : $!\n";

}


sleep 60;

foreach (@_fh) {
    close($_);
}

[jaundice][04:38:14][~/scripts]
> ./open_file_pointers.pl
Couldn't open port 8801 : Address already in use