从其他主机的Andr​​oid模拟器访问REDIR口模拟器、主机、oid、Andr

2023-09-04 08:12:47 作者:踮起脚尖ヘ靠近幸福ソ

在有一个Android应用程序的服务器插槽的运行,这是我调试使用模拟器。使用模拟器控制台和再导向添加TCP:8888:8888我可以提供给我的开发机器上运行(为localhost:8888)的节目服务。

Have a server-socket running in an android application, which I debug using the emulator. Using the emulators console and "redir add tcp:8888:8888" I can make the service available to a program running on my development machine (as localhost:8888).

该再导向端口但是不提供任何其他网络接口,这意味着我无法通过主机的IP访问它在本地开发机,或从辅助计算机在网络上。任何人都知道,如果它能够使仿真器绑定到所有网络接口,或者有一些其他的技巧,使网络上的其他主机连接到仿真器?

The redir port is however not available on any other network interface, meaning I can't access it through the host-ip on either the local development machine, or from a secondary machine on the network. Anyone know if its possible to make the emulator bind to all network interfaces, or have some other trick to enable other hosts on the network to connect to the emulator?

感谢

推荐答案

从技术上讲,在本地环路模拟器界插座。您可以从netstat命令查看它

Technically, the emulator bounds socket on the local loopback. You can see it from the netstat command

$ netstat -an | more
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
...
tcp4       0      0  127.0.0.1.8888         *.*                    LISTEN
...

本地地址应* 0.8888才能为您服务,从外部访问。

"Local Address" should be *.8888 in order for your service to be reachable from outside.

你唯一的办法是转发端口的物理接口的本地环路。

The only solution you have is to forward a port from the physical interface to the local loop.

在Linux上,这是系统我知道你正在使用,最简单的方法来做到这一点是通过使用任何源接口为输入127.0.0.1作为目的地址的iptables的手段。

On linux, which is the system I understand you are using, the easiest way to do it is by means of iptables using any source interface as input and 127.0.0.1 as destination address.

您将需要管理员权限,但它可以根据每个会话的基础上进行。

You will need administrator privileges but it can be done on a per-session basis.

 
精彩推荐
图片推荐