tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Detecting parent's termination



On Tue, Jan 31, 2012 at 03:04:56PM +0000, Emmanuel Dreyfus wrote:
 > > I just made a test case, writing to a closed SOCK_STREAM socket yields a
 > > SIGPIPE, while the same test with SOCK_SEQPACKET does not. That is a
 > > bug.
 > 
 > I was wrong: SOCK_SEQPACKET also fires a SIGPIPE, but the difference is
 > that when doing a write(2), it returns immediatly, while SOCK_STREAM seems 
 > to return when the other side dies or consume the data. Due to the way
 > my test case was written, I did not see the SIGPIPE with SOCK_SEQPACKET
 > because the process terminated too early.
 > 
 > This leads to another question: is it fine that write() on SOCK_SEQPACKET
 > is by default in non blocking mode?

I don't understand. It's a socket. You write into a buffer, it's
transmitted asynchronously. How much you can write without blocking is
not specified and will depend on circumstances.

Without further evidence I suspect the timing difference you're seeing
depends mostly on the behavior of connect().

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index