use IO.select and IO.read_nonblock