用asyncHttpClient上传文件报错org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.102:8888 refused

仙剑问情 发布于 2016/05/12 21:01
阅读 882
收藏 0

我用AsyncHttpClient上传文件及参数到服务器报错:org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.x.x:8888 refused

我是用真机测试,很奇怪的就用手机的个人热点可以上传成功,但是用办公室的网络就报错

求大神指点,以下是我的代码

AsyncHttpClient client = new AsyncHttpClient();
 client.setConnectTimeout(10000);
        client.setTimeout(10000);
  RequestParams params = new RequestParams();
  params.put("senselogid", senselogid);
            params.put("name", name);
            params.put("age", age);
            params.put("picfile", imgFile);
   
  client.post(url, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, Header[] headers,
                                  byte[] responseBody) {


}

 @Override
            public void onFailure(int statusCode, Header[] headers,
                                  byte[] responseBody, Throwable error) {

                               Log.e("error", error.toString());

}
}



url路径以及参数都打印过了,是完整正确的,就是不知道为什么用办公室网络上传的时候报 错:

org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.x.x:8888 refused

求大神解答


加载中
返回顶部
顶部