WEB开发网      好站好分享!你的一份分享是我们的一份动力;请分享 ---﹥
开发学院手机开发Android 开发 Android 请求本地 localhost/127.0.0.1 阅读

Android 请求本地 localhost/127.0.0.1

 2010-03-19 15:45:00 来源:WEB开发网 减小字体增大字体】  关注杨恒飞的微博
核心提示:本来想访问本地配置好的apache,获取http://localhost/test.xml文件,发现老是报错:connection refused,通过强大的google知道:要通过模拟器访问自己电脑的’阿帕奇’需要使用:http://10.0.2.2/test.xml,Android 请求本地 localhost/1

本来想访问本地配置好的apache,获取http://localhost/test.xml文件,发现老是报错:connection refused。

通过强大的google知道:要通过模拟器访问自己电脑的’阿帕奇’需要使用:http://10.0.2.2/test.xml。

在模拟器中,localhost默认是指模拟器本身,所以才有了这个10.0.2.2。

Tags:Android 请求 本地

编辑录入:coldstar [复制链接] [打 印]
赞助商链接