Re: SO_NOSIGPIPE option.
Re: SO_NOSIGPIPE option.
- Subject: Re: SO_NOSIGPIPE option.
- From: Vincent Lubet <email@hidden>
- Date: Wed, 7 Oct 2009 14:43:43 -0700
On Oct 7, 2009, at 2:27 PM, Glenn Anderson wrote:
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.
This is true and is a fall-out of the Unix conformance that specifies
that the setsockopt(2) function shall fail with EINVAL the socket has
been shut down"
To restore the old non-standard behavior, Mac OS X 10.6 SnowLeopard
has a new socket option SO_NP_EXTENSIONS that allows to call setsockopt
(2) after the connection is shutdown.
Vincent
_______________________________________________
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