开发者

Accessing localhost from android over wifi

开发者 https://www.devze.com 2023-03-01 01:50 出处:网络
I have written a Https webservice,开发者_如何学Python so it is encrypted with SSL. For testing i would like to acces that webservice over wifi.

I have written a Https webservice,开发者_如何学Python so it is encrypted with SSL.

For testing i would like to acces that webservice over wifi.

edit Example: My webservice is running on a VM number 111, i want to acces it over wifi so the adress would be https://VM111/Webservice/service.svc. I can acces it from any laptop in the wifi network but not from the Android Phone, that is my problem.

Is there a way to acces the localhost of the VM, from the Android phone, and has anyone dealt with this before?

My gues is that is has something to do with domains because every other device is in the Active directory.

If there are any questions about my question i am glad to answer them,


You can get a public URL for your server running on a specific port on localhost.

At my work place I could access the local server by using the local IP address of my machine in the app, as most of the other answers suggest. But at home I wasn't able to do that for some reason. After trying many answers and spending many hours, I came across https://ngrok.com. It is pretty straight forward. Just download it from within the folder do:

ngrok portnumber

( from command prompt in windows)

./ngrok portnumber

(from terminal in linux)

This will give you a public URL for your local server running on that port number on localhost. You can include in your app and debug it using that URL.

You can securely expose a local web server to the internet and capture all traffic for detailed inspection. You can share the URL with your colleague developer also who might be working remotely and can debug the App/Server interaction.

Hope this saves someone's time someday.


I found a quick solution to this problem. try this link, it should help you guys fix the problem. http://www.mobitechie.com/android-2/how-to-access-localhost-on-android-over-wifi/

I only changed 1 thing, where the tutorial states you change '127.0.0.1' to 'All', change it to the ip address your server is running on instead.

after that you should be able to connect to your localhost.


I was also looking for something similar from desktop type ipconfig you will get desktopIP now put that in android browser you should get your localhost

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号