b888 has asked for the wisdom of the Perl Monks concerning the following question:
Greetings.
perldoc says about send: ...returns the number of characters sent, or the undefined value if there is an error.. It's not written that it can exit without message, but i met exact this one. I'm using socket communication via unix sockets, and if client part exits before server sent reply, than server just silently go away.
eval { local $SIG{'ALRM'} = sub { die "time\n" }; alarm( $self->{'_write_timeout'} ); print "\n#1"; $c = send $self->{'_sock'}, $buf, 0; print "#2"; alarm( 0 ); }; if( $@ ){ print "#3"; } print "#4";
Returns "\n#1" (only if client went away, in other situations all seem to work just fine). Spent few days reading manuals, still got no clue.
v5.8.5 built for i386-linux-thread-multi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "send" surprise
by salva (Canon) on Mar 30, 2006 at 16:17 UTC | |
by merlyn (Sage) on Mar 30, 2006 at 16:27 UTC |