my $recsock; while(!defined $recsock){ eval{$recsock = IO::Socket::INET->new(PeerAddr=>'localhost',PeerPort=>1066,Proto=>'tcp')||croak"$!"}; } print "son here, opening inbound socket\n"; while(<$recsock>){ print "received $_"; }