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!
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
.