HttpClient 4 设置超时
httpclient 超时
有时httpclient的时候,需要等待N长时间,可能此时你决定放弃或者重试。
实现上非常简单 添加一个参数即可
这里的超时单位是毫秒。
[url=http://www.shanhe114.com][img]http://www.shanhe114.com/logo.gif[/img][/url]
[url=http://www.shanhe114.com]长春都市网[/url]
httpclient 超时
有时httpclient的时候,需要等待N长时间,可能此时你决定放弃或者重试。
实现上非常简单 添加一个参数即可
httpClient.getParams().setIntParameter("http.socket.timeout",3000);
这里的超时单位是毫秒。
[url=http://www.shanhe114.com][img]http://www.shanhe114.com/logo.gif[/img][/url]
[url=http://www.shanhe114.com]长春都市网[/url]