简体   繁体   English

无法将套接字连接到本地服务器

[英]Failed connecting socket to local server

Although I set ip address to 10.0.2.2 as recommended, the instruction 尽管我按照建议将ip地址设置为10.0.2.2,但该说明

Socket s = new Socket("10.0.2.2",8080);

still gives me 还给我

08-24 08:02:54.404: W/System.err(1030): failed to connect to localhost/127.0.0.1 (port 8080): connect failed: ECONNREFUSED (Connection refused)

I'm sure server works because I tried it with another client program, so emulator has something wrong...can you help me? 我确定服务器可以正常运行,因为我在另一个客户端程序上进行了尝试,因此模拟器出了点问题...您能帮帮我吗? edit: android.permission.internet is set too! 编辑:android.permission.internet也被设置!

A similiar question has been asked at: 有人问了一个类似的问题:
setup the android emulator to access the LAN of the host 设置android仿真器以访问主机的LAN

See what you can find there. 看看在那里可以找到什么。

检查是否有任何防火墙正在运行,并且某些防病毒充当防火墙,因此请停止防病毒并重试

解决了...这只是代码中的一个错误,与主要过程无关...对不起!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM