Your program has forked and you want to tell the other end that you're done sending data. You've tried
shutdown(SOCKET, 0); # I/we have stopped reading data shutdown(SOCKET, 1); # I/we have stopped writing data shutdown(SOCKET, 2); # I/we have stopped using this socket
On an IO::Socket object, you could also write:
$socket->shutdown(0); # I/we have stopped reading data
When a process forks, the child has copies of all the parent's open filehandles, including sockets. When you
Take the case of a socket that data is being sent to. If two processes have this socket open, one can close it but the socket isn't considered closed by the operating system because the other still has it open. Until the other process closes the socket, the process reading from the socket won't get an end-of-file. This can lead to confusion and deadlock.
To avoid this, either
The numeric argument to
Imagine a server that wants to read its client's request until end of file, and send an answer. If the client calls
Copyright © 2002 O'Reilly & Associates. All rights reserved.