Support read and write from blocking and non-blocking pipes and sockets