
11 Mar
2011
11 Mar
'11
10:15 a.m.
On 03/11/2011 05:30 AM, Wen Congyang wrote:
Yep, makes sense. I'm double checking whether I reliably closed the write end of the socket in all paths, and it may boil down to changing the child to_always_ sendmsg even if there is no fd to send. I'm still thinking about it.
Using SOCK_STREAM instead of SOCK_DGRAM to create socketpair can resolve this problem. But I don't know why.
At least with AF_INET that would be obvious: with SOCK_STRAM exiting the child will close the connection. With a datagram socket, the parent can still wait for other messages to the same UDP port. I have no idea whether things work the same for AF_UNIX, but apparently they do. :) Paolo