Re: SO_NOSIGPIPE option.
Re: SO_NOSIGPIPE option.
- Subject: Re: SO_NOSIGPIPE option.
- From: Glenn Anderson <email@hidden>
- Date: Thu, 8 Oct 2009 10:27:40 +1300
At 12:27 pm -0700 7/10/2009, Robert Bell wrote:
Hi all,
I was recently recommended to use the SO_NOSIGPIPE option to
avoid signals on a Mac OS X based system. I have noticed though that
this seems to work fine on Mac OS 10.6, but when run on 10.5.8 (have
not checked other versions), the socket still generates SIGPIPE.
One problem I ran in to with 10.5 is that setsockopt for SO_NOSIGPIPE
changed from 10.4 and earlier and no longer works if the socket is
already closed. This means that if the socket closes before your code
gets a chance to call setsockopt, you don't check if setsockopt
failed, and you write to the socket, that will generate a SIGPIPE.
As timing is usually involved to end up in a situation where the
socket has closed before the call to setsockopt, this can result in
hard to reproduce problems.
It is also possible the behavior of setsockopt for SO_NOSIGPIPE on a
closed socket has changed back again under 10.6, I haven't tried it
myself.
Glenn.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden