我怎样才能把我的本地主机的IP地址到Android模拟器? [英] How can I forward my localhost IP-Address to an Android Emulator?

查看:695
本文介绍了我怎样才能把我的本地主机的IP地址到Android模拟器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道它是可以从我的开发机的Andr​​oid模拟器转发端口,但是这是怎么做的? 我发现在Android的开发者网站上的解决方案,但我看不出他们是如何意味着他们的指示? 任何人有这方面的一些明确的指示?我的开发机运行的是Windows。

I know it is possible to forward a port from my develop machine to an Android emulator, but how is this done? I've found the solution on the android-developers site, but I couldn't see how they've meant their instructions... Anybody got some clear instructions on this? My develop machine is running Windows.

推荐答案

要转发端口从本地计算机到Android模拟器,你需要有远程登录功能。这是通过控制面板完成的 - >程序和功能 - > Windows功能打开或关闭 - >向下滚动到Telnet客户端。然后选择它和放大器; preSS确定。现在从命令提示符(与模拟器中运行),键入远程登录本地主机EmulatorPortNumber。而EmulatorPortNumber可以在仿真器的标题栏可以发现,在我的情况下,它是5554。

To forward a port from your local machine to an Android Emulator, you need to have Telnet enabled. This is done through the Control Panel -> Programs and Features -> Turn Windows features on or off -> scroll down to Telnet Client. Then select it & press Ok. Now from your command prompt (with the Emulator running) you type telnet localhost "EmulatorPortNumber". The "EmulatorPortNumber" can be found in the titlebar of the Emulator, in my case it was 5554.

现在你会看到类似这样的:

You will now see something similar to this:

Android Console: type 'help' for a list of commands
OK

在这里,你想用尽可能少错字的,因为当你申请退格,它会破坏你的命令,不接受输入。你要在这里使用的命令是 REDIR 。这将让你从3子选择:

Here, you want to type with as little as possible typo's, as when you apply the backspace, it will corrupt your command and not accept it. The command you have to use here is redir. This will let you choose from 3 subcommands:

list    list current directions
add     add new redirection
del     remove existing redirection

您现在需要的是补充。但是你不能使用它就是这样。键入 REDIR添加会给你下面一行:

The one you need now is add. But you can't use it just like that. Typing redir add will give you the following line:

KO: bad redirection format, try (tcp|udp):hostport:guestport

这意味着,你必须指定要转发(TCP或UDP端口),要转发(HOSTPORT)及该端口在本地机器上有什么样的端口;你想在模拟器(guestport)设置的端口。 因此,使用这样的命令:

This means that you have to specify what kind of port you want to forward (TCP or UDP port), which port on the local machine you want to forward (hostport) & which port you want to set on the Emulator (guestport). So, using a command like this:

redir add udp:1337:12345

转发模拟器上的本地计算机上的U​​DP端口1337到12345端口。要谨慎删除重定向,因为它们可能会崩溃你的模拟器。您也可以直接关闭仿真器,以消除任何重定向。它更容易与放大器;安全...

forwards the UDP port 1337 on the local machine to port 12345 on the Emulator. Be cautious about deleting redirections, as they might crash your Emulator. You can also simply close the Emulator to remove any redirections. It's easier & safer...

这篇关于我怎样才能把我的本地主机的IP地址到Android模拟器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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