in reply to Re^3: SIG{'PIPE'} and pipe timeout
in thread SIG{'PIPE'} and pipe timeout
The pipe signal only occurs after a long period of inactivity on the client side, not on the server side (which also uses the 'pipe' to send messages to the client)my $child = my $parent = my $pid = undef; # Create a socket pair from IPC (both ways) if (!socketpair($child, $parent, AF_UNIX, SOCK_STREAM, PF_UNSPEC)) + { die "socketpair failed: ".$!; } else { # Flush messages immediately $child->autoflush(1); $parent->autoflush(1); if (!defined($pid = fork())) { die "Fork failed: ".$!; } elsif ($pid == 0) { close($child); # Here the process will carry out the work, and also write + to the 'pipe' # It will only exit this loop upon SIGTERM # Close the pipe with the parent close($parent); exit 0; } else { close($parent); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: SIG{'PIPE'} and pipe timeout
by zentara (Cardinal) on Feb 07, 2006 at 16:30 UTC | |
by Marcello (Hermit) on Feb 08, 2006 at 10:52 UTC |