在做游戏开发的时候,有时候会遇到cocos2dx httpclient 经常超时的现象,所以现在已经总结了一些超时的设置。
使用是apache的HttpClient:
DefaultHttpClient:
请求超时httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 60000);
读取超时httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 60000);
HttpClient
HttpClient httpClient=new HttpClient();
链接超时httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(60000);
读取超时httpClient.getHttpConnectionManager().getParams().setSoTimeout(60000)