
Christopher Kohlhoff <chris@kohlhoff.com> writes:
--- Oliver.Kowalke@infineon.com wrote:
Only if write/sendto is called on a closed socket SIGPIPE should be blocked by your library. In all other cases the user defined signal handler for SIGPIPE should be called. In your solution the user can only ignore SIGPIPE globally (even if the signal is generated from other sources than sockets) or install its own signal handler - and so be forced to distinguish between SIGPIPE from socket and other sources (problem - multiple sockets; which socket has generated the signal?).
I agree, what you describe is the ideal solution. However I was unable to work out how to ignore the signal just for some operations. Can you tell me how to do this?
Yes, simply include the MSG_NOSIGNAL flag in the call to send or sendto.
[snip]
-- Jeremy Maitin-Shepard