发起请求的代码:
SocketChannel socketChannel = SocketChannel.open(); socketChannel.connect(new InetSocketAddress("http://www.test.com", 80));
1)如果请求返回的数据总量是1000byte;这时这1000byte是不是已经返回到客户端了?
从SocketChannel中读取数据:
int bytesRead = socketChannel.read(buf);
2)如果buf大小是1byte,只执行一次read方法后,那剩余的999byte数据在哪里呢?
慕的地8271018
相关分类