简体   繁体   English

如何在不使用互联网连接的情况下将android物理应用中的http消息发送到本地服务器?

[英]How can I send http messages from android app( physical device) to my local server without using internet connection?

I have an app that runs in an emulator. 我有一个在模拟器中运行的应用程序。 The app sends multiple messages to my local server, for manipulating data. 该应用程序将多条消息发送到我的本地服务器,以处理数据。 While i was using the app in my emulator i was using: 当我在模拟器中使用该应用程序时,我正在使用:

http://10.0.2.2/path

to reach the server. 到达服务器。 I would like to use a physical device to connect to the server. 我想使用物理设备连接到服务器。 Does somebody know how to do this. 有人知道该怎么做吗? What adress i should use? 我应该使用什么地址?

Assuming that your devices are on the same Network (connected to the same router) as your computer, you can expose your computer's web server (Apache, presumably?) and then point your app directly at the local network IP address that your computer has (usually something like 192.168.1.x). 假设您的设备与计算机位于同一网络(连接到同一路由器)上,则可以公开计算机的Web服务器(大概是Apache),然后将应用程序直接指向计算机具有的本地IP地址(通常类似于192.168.1.x)。 I have found that the least painless way to do this is to use MAMP or WAMP or LAMP depending on your OS, but of course I have no idea what your specific situation is, so that solution may in fact make things a lot more complicated rather than less. 我发现最轻松的方法是根据您的操作系统使用MAMP或WAMP或LAMP,但是我当然不知道您的具体情况,因此该解决方案实际上会使事情变得复杂得多,反而比少。

In any event... your computer is on the network at a specific IP address, so it's just a matter of making sure that it's willing to serve this data on whatever port you are looking for it on. 无论如何,您的计算机都以特定IP地址在网络上,因此只需确保它愿意在要查找的任何端口上提供此数据。 If you provide more specification as to your circumstances, we can give a more detailed answer. 如果您提供有关您情况的更多说明,我们可以给出更详细的答案。

暂无
暂无

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

相关问题 如何使用移动热点从Android应用(物理设备)向本地服务器发送HTTP消息 - How can I send http messages from android app( physical device) to my local server using mobile hotspot 在没有互联网连接的情况下从安卓设备向服务器发送消息 - Send message to a server from android device without internet connection Xamarin应用(Android)无法从物理设备访问本地网络中的mongodb服务器 - Xamarin app (Android) can't access mongodb server in local network from physical device(s) 如何将文件从服务器发送到Android应用程序? - How I can send a file from my server to an Android app? 如何将数据从本地服务器推送到Android设备-没有GCM,没有Internet连接 - How to push data from local server to Android Device - No GCM, No Internet Connection 如何创建从本地服务器到 Android 设备的推送通知 - 没有 GCM,没有互联网连接 - How to Create push notofication from local server to Android Device - No GCM, No Internet Connection 在 Android 中无需服务器即可将 FCM 消息从一台设备发送到另一台设备 - Send FCM messages from one device to other without server in Android 如何使用 http 将 Android 中的文件从移动设备发送到服务器? - How do I send a file in Android from a mobile device to server using http? 如何从我的物理 Android 设备访问我的本地主机? - How can I access my localhost from my physical Android device? 如何在 Android Studio 中将我的物理设备作为模拟器运行? - How can I run my physical device as an emulator in Android studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM