Reputation: 2538
In solaris how to detect broken socket in send() call? i dont want to use signal.
i tried SO_NOSIGPIPE and MSG_NOSIGNAL but both are not available in Solaris and my program is getting killed with "broken pipe" error.
Is there any way to detect broken pipe?
Thanks!
Upvotes: 1
Views: 2267
Reputation: 24905
I guess in Solaris you have only limited options. AFAIK, sigaction suggested by caf appears to be the best solution.
Upvotes: 1
Reputation: 239171
You'll have to use sigaction()
to specifically ignore the SIGPIPE
signal:
struct sigaction act;
act.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &act, NULL);
...then send()
will return -1 with errno
set to EPIPE
.
Upvotes: 1