while (1) { if (there_is_something_to_read($rdr)) { $reply = get_everything_from_the_pipe($rdr); last; } }