3 ms·
>and hence while either fd is open, the kernel can not detect a close. Which is what the author wants. He wants the socket to close once both generate-data and
by charcircuit 3y ago
>and hence while either fd is open, the kernel can not detect a close.
Which is what the author wants. He wants the socket to close once both generate-data and consume-data are done with the socket.
- dfawcus 3y agoNo, he wants a way for the close of the FD from generate-data to process-data to trigger a TCP FIN over the connection, such that process-data sees an input EOF. However for that to work, the two FDs (generate-date to process-data, and process-data to consume-data) must not be associated with the same "open file", even though they could (with a change) represent the same TCP socket. i.e. he wants generate-data to exit, closing its output FD, and have that drive EOF all the way through to consume-data. Such that consume-data does not determine it is done until it sees EOF on its input socket. (One can observe a similar issue if one opens FIFO's in read/write mode, but since they can also be opened read-only or write-only, the issue does not arise.)