On Tue, 20 Feb 2007, Amos Shapira wrote:

You are getting off subject - the original question was about how to find
> out that the other side of a socketpair has closed it.

There is none. That's the point. You can monitor the pid to see if it
went away. Worse if the process becomes a zombie then even that will not

Which pid? The child may very well have forked and exited so the parent is
actually talking to its grand-children, it could also be that multiple
processes are sharing the same socketpair on the other side (that's another
contingency I'll have to take care of).

Then again - if the socketpair() is "connected" (e.g. SOCK_STREAM or
SOCK_SEQPACKET) then the kernel will notify the parent as soon as the other
side was closed. Remember we are talking about Unix domain sockets.

Maybe I did not get the question. We seem to be talking past each other. man socket(2) says that SOCK_STREAM type sockets implement a timeout so they DO detect that the remote it not ok (by hiatus). SOCK_SEQPACKET seems to be mutually exclusive with nonblocking use. setsockopt(2) documents the timeouts which you can set.

Peter (dense at 4AM)

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to