The server may die before connecting to the client. In that case, the client was blocked indefinitely (until Ctrl+C) on accept(). To avoid the problem, use a pipe and a select() before calling accept(), so that the blocking call can be interrupted. Once accept() is called, it is guaranteed not to block.