您的位置:首页 > 理论基础 > 计算机网络

Android Httpclient设置超时

2011-03-03 11:07 399 查看
private HttpClient httpclient;
private HttpPost httppost;
private HttpParams httpParameters;
private int timeoutConnection = 3000;
private int timeoutSocket = 5000;
public WidsetsHttpClient() {
httpParameters = new BasicHttpParams();// Set the timeout in milliseconds until a connection is established.
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);// Set the default socket timeout (SO_TIMEOUT) // in milliseconds which is the timeout for waiting for data.
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
httpclient = new DefaultHttpClient(httpParameters);
httppost = new HttpPost(Display.serviceAPI);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: