Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you access a local port 8080 url from an android http get

I have a restful web service located on a local tomcat instance.

I'm trying to access the url via a get in my application but am getting the error: host is unresolved

I try to access this url from my android emulator browser to confirm the connection there and am unable to get to it their either. An alert comes up on the screen that says: "an sd card is required to download 125562.bin"

I am not using localhost in my url but something that looks like:

http://192.168.1.2:8080/service/0/12345

It returns straight json

Does anyone know why I can't access this in the android emulator? I can successfully hit this same address from my computer browser as well as iPhone and it brings back json.

Does android handle other ports differently than standard port 80? Is the problem this url doesn't have an extension?

like image 222
Atma Avatar asked Aug 04 '11 01:08

Atma


People also ask

How do I use port 8080?

Port number 8080 is usually used for web servers. When a port number is added to the end of the domain name, it drives traffic to the web server. However, users can not reserve port 8080 for secondary web servers.


1 Answers

The Android-Emulator has a virtual router, which cut's the Emulators network from the host-computers network.

However, this router is part of the network, too and enables you to access servers running on the local machine by using the IP 10.0.2.2.

So you would use:

http://10.0.2.2:8080/service/0/12345
like image 162
Lukas Knuth Avatar answered Sep 24 '22 13:09

Lukas Knuth