in reply to IO::Socket reconnect
Try catching the SIGPIPE signal. Something like:
will likely work. If a SIGPIPE error happens while printing to the socket, the flag "$b_err" gets set, and you can then handle the error appropriately.my $b_err = 0; $SIG{'PIPE'} = sub { $b_err = 1 }; print $agent_socket $monitoring_node . ".lmonitor." . $monitoring_ +name . ".rtt.value=" . $latency . "\n"; if ($b_err) { # .... Handle the SIGPIPE error }
Oh, one other note -- isn't:
print $agent_socket "$monitoring_node.lmonitor.$monitoring_name.rtt.v +alue=. $latency .\n";
a lot easier to read than the original? ;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: IO::Socket reconnect
by nikita.af (Acolyte) on Feb 15, 2016 at 01:17 UTC |