Can a client determine whether the server has accept()'d a unix socket?

Posted by Havoc P on Stack Overflow See other posts from Stack Overflow or by Havoc P
Published on 2010-04-30T19:02:48Z Indexed on 2010/04/30 19:07 UTC
Read the original article Hit count: 281

I'm dealing with a buggy server that will sometimes fail to accept() connections (but leaves its listening socket open). This is on Linux with unix domain sockets.

Currently the only way to detect this is that after sending a bunch of data, the buffer fills up and blocks, and the server isn't sending any replies. This long-after-the-fact failure mode is hard to distinguish from other bugs - the server could be unresponsive for other reasons.

Especially for unix domain sockets it seems the kernel should know whether accept() has occurred; is there any way to find this out? Can the client block until accept() happens somehow, or at least check whether it has?

This is just for debugging purposes so it can be a little ugly.

© Stack Overflow or respective owner

Related posts about linux

Related posts about socket