Question

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!

Was it helpful?

Solution

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.

OTHER TIPS

I guess in Solaris you have only limited options. AFAIK, sigaction suggested by caf appears to be the best solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top