|
Using dup2 would give you two read/write file descriptors. If you close one nothing happens, because the Unix kernel waits until the last once is closed before doing anything. Closing stdout/fd 1 in a inetd client will not magically do a 'shutdown' on the sending side of a TCP connection. Bernstein's problem still exists.
A call to 'shutdown' signals that you are done sending or receiving information. It's mostly useful if you want to effectively send an end-of-file but you want to continue reading the reply. If you want to stop reading and writing altogether just use 'close', it effectively does a shutdown in both directions and remove the socket handle. Gé -- Gé Weijers |