androidhttpclientHostisunresolved错误解决方案.doc
上传人:sy****28 上传时间:2024-09-13 格式:DOC 页数:7 大小:34KB 金币:15 举报 版权申诉
预览加载中,请您耐心等待几秒...

androidhttpclientHostisunresolved错误解决方案.doc

androidhttpclientHostisunresolved错误解决方案.doc

预览

在线预览结束,喜欢就下载吧,查找使用更方便

15 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

??è?…?????????é????°è?????é??é?????????????????”¨wifiè????????????‰é??é??????…?é??wifi???è?…?????¨wifi??????????°±?????è??????‘???????????¨???è??è?…????…????è??????????http://blog.csdn.net/dropWater_yjqbll/archive/2010/12/16/6079531.aspx?????è??????????è????????????‘???????‰????é????é??è???¤???¨???è?…è?”é?????????????????è?·?±?????‰???????????????‘é???????????è???·±???????±??????????publicstaticStringrequest(intnetType,Stringhost,Stringurl,intmethod,ListNameValuePairpamrams){if(netType==HttpUtil.WAP_INT){//wap????‘HttpRequestBaserequest=null;StringstrReust=null;try{//wap//?????http://klmu.v228.10000net.cn/publicbicycle???klmu.v228.10000net.cnHttpHosttarget=newHttpHost(getHostStr(host),Integer.parseInt(getPort(host)));if(method==0){request=newHttpPost(getUrl(host,url));if(pamrams!=null){((HttpPost)request).setEntity(newUrlEncodedFormEntity(pamrams,HTTP.UTF_8));}}elseif(method==1){request=newHttpGet(url);}//??°???HttpClient???è±?DefaultHttpClienthttpClient=newDefaultHttpClient();HttpHostproxy=newHttpHost(10.0.0.172,80);httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);HttpResponsehttpResponse=httpClient.execute(target,request);if(httpResponse.getStatusLine().getStatusCode()==HttpStatus.SC_OK){strReust=EntityUtils.toString(httpResponse.getEntity());}else{strReust=HTTPERROR_Start+????????¨httpCode:+httpResponse.getStatusLine().getStatusCode()+HTTPERROR_END;}httpClient.getConnectionManager().shutdown();}catch(Exceptione){strReust=HTTPERROR_Start+e.getMessage()+HTTPERROR_END;}returnstrReust;}elseif(netType==HttpUtil.WIFI_INT){//wifiurl=host+url;HttpRequestBaserequest=null;StringstrReust=null;try{if(method==0){request=newHttpPost(url);if(pamrams!=null){((HttpPost)request).setEntity(newUrlEncodedFormEntity(pamrams,HTTP.UTF_8));}}elseif(method==1){request=newHttpGet(url);}//è????è??