如何连接到android内部localhost [关闭](How to connect to android internal localhost [closed])

我正在编程,所以请帮助我解决一些问题。

我从Google Play下载应用程序来过滤网络搜索。 如果黑名单中的URL然后重定向到此网页localhost:50099/block.html

我的查询是如何连接这个本地服务器?

I am to programming so please help me in some issues.

I download app from Google play that filter web searches. If URL in blacklist then redirect to this webpage localhost:50099/block.html

My query is how to connect this local server?

最满意答案

您正在运行的应用程序很可能拥有自己的内部网络服务器。 如果您在正在运行的应用的导航地址栏中看到该地址,那么您可能无法在应用外部访问该地址。

您是否从应用程序内部浏览网页? 你想达到什么目的? 如果您想访问在对其他应用程序开放的Android设备上运行的内部Web服务器,那么您应该能够使用您记下的URL访问它。 在这两种情况下,我都看到应用程序内部的轻量级Web服务器,只能在应用程序内部访问,并且可以在应用程序外访问。

更新:因为你的问题现在是'如何在Android上创建轻量级HTTP服务器':

试试这个: HTTPD

使用非常简单,例如:

NanoHTTPD serverObj = new NanoHTTPD(50099,new File("."));

It is likely that the app you are running has its own internal web-server. If you see that address in the navigation address bar of the app you are running then you may not be able to access it outside of the app.

Are you browsing the web from inside the app itself? What are you trying to accomplish? If you want to access an internal web-server running on an android device which is open to other apps, then you should be able to access it using the URL you noted. I have seen light weight web-servers internal to apps in both conditions, only accessible internally within the app and accessible outside of the app.

UPDATE: Since your question is now 'How to create a lightweight HTTP server on Android':

Try this: HTTPD

It is very simple to use, eg:

NanoHTTPD serverObj = new NanoHTTPD(50099,new File("."));

更多推荐