This code does work, but it's assuming the client has to write to the server, and then the server replies. While this is generally the case, it's ALSO possible for the server to write to the client without first receiving any information. For example, the client could send the server "data:foo", then the server responds "received". If that was all the information the server needed to complete the operation, it would then respond saying whether the task completed successfully or not. The reason I was forking is so that I have a persistant child listening for whatever the server said.