如何从连接的Andr​​oid设备通过了Htt prequest访问本地的Tomcat [英] How to access local tomcat via HttpRequest from connected Android device

查看:133
本文介绍了如何从连接的Andr​​oid设备通过了Htt prequest访问本地的Tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然从仿真器访问工作正常:

While accessing from emulator works fine with:

  response = CustomHttpClient.executeHttpPost(
                "http://10.0.2.2:8080/DWAP/SERVLET", postParameters);

当我从我的Andr​​oid设备编写

when I write from my Android device

 response = CustomHttpClient.executeHttpPost(
                "http://XX.XX.XX.XX:8080/DWAP/SERVLET", postParameters);

在哪里XX.XX.XX.XX是我的公网IP​​我没有得到访问本地服务器。

Where xx.xx.xx.xx is my public IP I do not get access to the local server.

有一个简单的方法来从Android设备测试的应用程序访问本地Tomcat或做我需要模拟器来测试只?

Is there an easy way to test the app from an Android device to access the local Tomcat or do I need to test with emulator only?

不要需要经过端口fprwarding我的路由器或有另一种方式来对我的WLAN连接内部。 (Android手机< - > MAC与本地的Tomcat)?

Do need to go through port-fprwarding on my router or is there another way to connect "internally" on my WLAN. (Android mobile phone <-> MAC with local Tomcat)?

推荐答案

尝试设置您的计算机作为路由器的DMZ。
这样一来,你的路由器(公网IP)通信直接导致您的计算机(本地IP)。

Try setting your computer as the DMZ of the router. This way, communication with your router (public ip) leads directly to your computer (local ip).

这篇关于如何从连接的Andr​​oid设备通过了Htt prequest访问本地的Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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