Android Connection Refused
来源:互联网 发布:windows.old删除不掉 编辑:程序博客网 时间:2024/05/05 07:12
想通过Android调用web应用的一个servlet,
URL url = new URL("http://localhost:8089/Test1/servlet/ServletDemo");
URLConnection connection = url.openConnection();
一直报 localhost/127.0.0.1:8089 - Connection refused
很是奇怪,查了一下 原来android模拟器(simulator)把它自己作为了localhost,也就是说,代码中使用localhost或者127.0.0.1来访问,都是访问模拟器自己
解决方法:
cmd——》ipconfig/all——》获得本机ip——》修改URL url = new URL("http://本机ip:8089/Test1/servlet/ServletDemo");
这样 问题就解决了
转载地址:http://blog.csdn.net/applezhengxd/article/details/5577581
0 0
- android connection refused
- Android connection refused
- Android Connection Refused
- 关于android localhost connection refused
- Android Connection Refused问题处理
- android connection to ip refused
- android httpclient localhost Connection refused
- connection refused
- android 连接本地服务器Connection refused问题
- android java.net.ConnectException: Connection refused: connect
- android下载文件错误:Connection refused
- Android :Connection to http://localhost:8080 refused
- android网络编程connection refused问题
- 解决Android网络编程中的connection refused
- android socket通信 Connection refused异常
- android java.net.ConnectException: Connection refused
- java.net.ConnectException: Connection refused (Connection refused)
- 解决Android网络编程中的connection refused--Android开发经验
- junit 异常测试
- List泛型自定义类型排序和大小比较C#版
- SEH exception with code 0xc0000005 error
- 我硕士毕业为什么在佳木斯卖米粉d
- 工业平板电脑是未来的趋势
- Android Connection Refused
- junit 4 超时测试
- 禁用ActionBar方法
- eclipse的SVN插件安装
- 四种SQL分页语句
- Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
- Cracking The Coding Interview 3.2
- junit 4 参数化测试
- android检测网络是否连接,WIFI是否连接