Beechbone has asked for the wisdom of the Perl Monks concerning the following question:
This are two snippets, each is also burried in a couple of eval()s. As a target I connect to "nc -l -p 1234". As soon as I kill the nc (ctrl-c), the next syswrite() will exit the program without any message. I even ran a trace:my $sock = eval { IO::Socket::INET->new( PeerAddr => $host, PeerPort => $port, Proto => 'tcp', ) or die $@; }; # ... my $lw = syswrite($sock, $$data); #line 91 die $! unless defined $lw and $lw == length($$data);
Exactly what I'd expect, exept that the program just ends there. (line 91 is the syswrite())... 1122277564.69174 main /root/iosrv.pl 91 1122277564.69182 main /root/iosrv.pl 92 1122277564.69185 main /root/iosrv.pl 93 1122277564.69188 main /root/iosrv.pl 95 1122277564.6919 main /root/iosrv.pl 100 1122277564.69193 main /root/iosrv.pl 39 1122277574.70139 main /root/iosrv.pl 36 1122277574.70156 main /root/iosrv.pl 37 1122277574.70159 main /root/iosrv.pl 38 1122277574.70162 main /root/iosrv.pl 85 1122277574.70165 main /root/iosrv.pl 86 1122277574.70167 main /root/iosrv.pl 88 1122277574.7017 main /root/iosrv.pl 89 1122277574.70172 main /root/iosrv.pl 90 1122277574.70174 main /root/iosrv.pl 91
I also tried to use print() instead of syswrite(), same problem. I tried with "v5.8.4 built for i686-linux" (self compiled) and "v5.6.1 built for i386-linux" (debian woody).
Any idea what the problem might be?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unexpected program abort on write on closed handle
by eyepopslikeamosquito (Archbishop) on Jul 25, 2005 at 08:38 UTC | |
by Beechbone (Friar) on Jul 25, 2005 at 08:57 UTC | |
by eyepopslikeamosquito (Archbishop) on Jul 25, 2005 at 10:49 UTC | |
by virtualsue (Vicar) on Jul 25, 2005 at 09:32 UTC | |
|
Re: unexpected program abort on write on closed handle
by anonymized user 468275 (Curate) on Jul 25, 2005 at 09:16 UTC | |
by Beechbone (Friar) on Jul 25, 2005 at 09:23 UTC | |
by anonymized user 468275 (Curate) on Jul 25, 2005 at 09:35 UTC |