unosquare / embedio

A tiny, cross-platform, module based web server for .NET
http://unosquare.github.io/embedio
Other
1.45k stars 175 forks source link

Android Emulator Port Forwarding #536

Open sachinkanadia opened 2 years ago

sachinkanadia commented 2 years ago

Describe the bug

Help needed with Android emulator port forwarding.

I have integrated EmbedIO into a Xamarin Forms App. All scenarios apart from Android emulator work. I understand that I need to setup Android port forwarding however, I am unsure which ports to assign.

When running the App on Android, the app shows that it is listening on the following url: http://10.0.2.16:8080. While the App is left running I'm going to the browser on the host machine and in the address bar I'm entering in: http://10.0.2.16:8080/api/ChangeBackGround but it fails to connect.

I've tried entering the following telnet commands in terminal:

redir add tcp:8080:8080 and redir add tcp:8080:5555

However, both commands apply successfully but, do not connect the host browser to the emulator and I am unsure which ports to assign to get the EmbedIO web server working.

Please could someone advise. Thanks

Expected behavior

After the ports have been successfully applied, the call to the url: http://10.0.2.16:8080/api/ChangeBackGround connects successfully.

Smartphone (please complete the following information):

rdeago commented 2 years ago

Hello @sachinkanadia, thanks for using EmbedIO and sorry for the very late answer.

As stated in this document by Google the address for the emulated Ethernet port should be 10.0.2.15, not 10.0.2.16. I'm not sure what's happening, and I have never used an Androis emulator, but I don't think TCP redirection will help.

Have you tried to disable Windows firewall on your development machine?

ferhrosa commented 2 years ago

@sachinkanadia, were you able to solve that? I am having exactly the same problem.

But note: when you configure a redirection on Android Emulator, you should be able to access it through the localhost address. On your case would be: http://localhost:8080/api/ChangeBackground