简体   繁体   English

无法从Linux连接到AVD上的Web服务器

[英]not able to connect to web server on AVD from linux

I have the following configuration : 我有以下配置:

1) One AVD runing on port 5554 on Windows7 laptop having ip : 192.168.2.2. 1)一个运行在IP地址为192.168.2.2的Windows7笔记本电脑上的端口5554上的AVD。

2) One UDP server running on Linux (ubuntu) laptop; 2)一台在Linux(ubuntu)笔记本电脑上运行的UDP服务器; listening to port 9999. The ip of this is 192.168.2.4 侦听端口9999。此IP为192.168.2.4

3) One Wifi router through which all of these are connect. 3)一台Wifi路由器,所有这些路由器都通过该Wifi路由器连接。 This acts as DHCP server & provides afore-stated ip to the laptops. 它充当DHCP服务器并为笔记本电脑提供上述ip。

I have written an app in which I communicate with the UDP server on Linux which is working perfectly. 我编写了一个与Linux上的UDP服务器通信的应用程序,该服务器运行良好。 This actually signifies there is no communication problem with my laptops (& program env). 这实际上表示我的笔记本电脑(&program env)没有通讯问题。 In the same app there is another thread which runs a WebServer listening on the TCP port 8888. 在同一应用程序中,有另一个线程运行Web服务器,侦听TCP端口8888。

I try to connect to my webserver from AVD emulator it works perfectly & the page is displayed on the emulator. 我尝试从AVD模拟器连接到我的Web服务器,它可以正常运行,并且页面显示在模拟器上。 When I try to access the same from Windows / linux it doesn't work. 当我尝试从Windows / linux访问同一文件时,它不起作用。 I read this page "http://developer.android.com/guide/developing/devices/emulator.html", particularly this section "Using Network Redirections", & redirected the following : 我阅读了此页面“ http://developer.android.com/guide/developing/devices/emulator.html”,尤其是本节“使用网络重定向”,并重定向了以下内容:

 redir add tcp:8888:8888

Now I try to access my web page from windows machine using google-chrome like this: 现在,我尝试使用google-chrome从Windows计算机访问我的网页,如下所示:

  "http://127.0.0.1:8888",

It works perfectly. 它运作完美。

Problem :: The which I am facing is; 问题::我面临的是; When I try to access the same webpage from liunx machine in google-chrome by the following URL: 当我尝试通过以下网址从google-chrome的liunx机器访问同一网页时:

  http://192.168.2.2:8888 &
  http://10.0.2.15:8888

I am unable to reach my WebServer. 我无法访问我的WebServer。

Kindly let me know what is that I am missing? 请让我知道我想念的是什么?

Thanks 谢谢

Check that iptables on linux is not blocking your port for external connections. 检查linux上的iptables是否没有阻止您的端口进行外部连接。 AFAIK defaut iptables config is very restrictive. AFAIK defaut iptables配置非常严格。

检查路由器..route http://127.0.0.1:8888是否已被路由器允许,因为其内部IP不是Web IP

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

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