Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Loopback address (10.0.2.2) not connecting

I'm using Xamarin/Mono for Android.

I'm trying to connect to a web service running on my dev machine from my android device which I'm debugging via USB using the loopback address with 10.0.2.2:

It seems that I'm not even able to ping the IP address...

var reply = ping.Send("10.0.2.2");

This is telling me the Time To Live has expired.

My Firewall is off, and I've added a rule to allow all connections for all ports and still it won't connect, so I'm all out of ideas....

like image 909
David Masters Avatar asked Feb 11 '26 22:02

David Masters


1 Answers

10.0.2.2 only works with the emulator.

For actual devices you can e.g. use your internal network address, provided that your computer and device are on the same network. For example, if the computer running your web service has IP 192.168.1.100 (use ifconfig/ipconfig to find out), use that as the address.

like image 115
laalto Avatar answered Feb 15 '26 09:02

laalto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!