fixed tcp_read to conformto return value of read_nonblock