连接失败:ECONNREFUSED [英] connect failed: ECONNREFUSED

查看:4721
本文介绍了连接失败:ECONNREFUSED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,一想我想要做的就是接收机器人从服务器数据库中的数据。于是我开始跑一些教程。我发现一个正在做pretty的很多我想要什么。 但我正在逐渐:

i am developing one app, and one think i wanna do is receive data from server database in android. So i started to run some tutorials. I found one that is doing pretty much what i want. But i am getting:

detailMessage   "failed to connect to localhost/127.0.0.1 (port 8080): connect failed: ECONNREFUSED (Connection refused)" (id=830021648792) 

这torial全code是这里链接

Whole code of this torial is here link

发生错误:

OutputStreamWriter OUT =新OutputStreamWriter(connection.getOutputStream());

我检查:

  • 在防火墙被禁用
  • 在平正在
  • 在连接字符串是完全一样的,当我运行的服务器管理界面中的servlet - 的http://本地主机:8080 /请求/ RQSRV -the servlet正在运行
  • firewall is disabled
  • ping is working
  • connection string is exactly the same as when i run the servlet from server admin interface - http://localhost:8080/Requestor/RQSRV -the servlet is running

我的配置:

  • 服务器:玻璃鱼4.0
  • Android应用 - 在Eclipse开发
  • 在Servlet的 - 在NetBeans开发

推荐答案

从Android模拟器访问PC本地主机,使用127.0.0.1的10.0.2.2代替。本地主机或127.0.0.1指的是模拟设备本身,而不是模拟器上运行的主机。

To access your PC localhost from Android emulator, use 10.0.2.2 instead of 127.0.0.1. localhost or 127.0.0.1 refers to the emulated device itself, not the host the emulator is running on.

参考:<一href="http://developer.android.com/tools/devices/emulator.html#networkaddresses">http://developer.android.com/tools/devices/emulator.html#networkaddresses

这篇关于连接失败:ECONNREFUSED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆