[ Team LiB ] Previous Section Next Section

Chapter 30

30.1

30.1

The parent keeps the listening socket open in case it needs to fork additional children at some later time (which would be an enhancement to our code).

30.2

Yes, a datagram socket can be used to pass a descriptor instead of using a stream socket. With a datagram socket, the parent does not receive an EOF on its end of the stream pipe when a child terminates prematurely, but the parent could use SIGCHLD for this purpose. One difference in this scenario, where SIGCHLD can be used versus our icmpd daemon in Section 28.7, is that in the latter, there was no parent/child relationship between the client and server so the EOF on the stream pipe was the only way for the server to detect the disappearance of a client.


    [ Team LiB ] Previous Section Next Section