Java httpclient 用如下HttpClient加流操作的方式获取response的内容
HttpGet httpGet =new HttpGet("http://www.baidu.com");
HttpResponse response = client.execute(httpGet);
HttpEntity entity = response.getEntity();
if (entity !=null) {
InputStream instream = entity.getContent();
int byteOne = instream.read();
int byteTwo = instream.read();
// Do not need the rest
httpGet.abort();
}
在.net httpclient应使用哪些api做怎么的相应处理?
如果能给出直接的代码让我研究学习那就最好啦^-^
HttpGet ----> var getTask = hc.GetAsync(new Uri(url));
HttpResponse --> HttpResponseMessage responseM = hc.GetAsync(new Uri(url)).Result;
大致有这么一个对应关系。