#!/usr/bin/perl use strict; use warnings; use Getopt::Std; use IO::Socket::INET; use vars qw($opt_s $opt_p $opt_n); getopts("s:p:n:"); die <>> Socket #$c\n"; my $s = new IO::Socket::INET->new ( PeerAddr => $opt_s, PeerPort => $opt_p, Proto => 'tcp', Timeout => 30, ); unless ($s) { warn "Failed to create socket $c: $!\n"; sleep 2; redo; } print "<<< $c connected ok\n"; push @socks, $s; } print "*** All concurrent connections done!\n";