Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that if I manage to reach the line print $socket "Hi!\n"; I will get the warning "print() on closed filehandle STDOUT" every time I try to print in the normal fashion after this point. However, I can print fine in those threads that dont manage to connect to a server socket (those that dont run the line print $socket "Hi!\n";). Why have STDOUT close down for some threads?my $socket = new IO::Socket::INET ( PeerAddr => $ipAddress, PeerPort => $port, Proto => 'tcp' ); if(defined $socket) { print $socket "Hi!\n"; $socket.close(); } else { print "Failed to connect to video server: $ipAddress, $port\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print() on closed filehandle STDOUT after printing to socket
by almut (Canon) on Mar 18, 2009 at 21:36 UTC | |
|
Re: print() on closed filehandle STDOUT after printing to socket
by ikegami (Patriarch) on Mar 18, 2009 at 22:06 UTC | |
|
Re: print() on closed filehandle STDOUT after printing to socket
by apl (Monsignor) on Mar 19, 2009 at 11:58 UTC |