rename read_n as read_nonblock and add tmp_write_buf
add old read_n