aspose file tools
The moose likes Android and the fly likes Accessing my web server URL fron my phone Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "Accessing my web server URL fron my phone" Watch "Accessing my web server URL fron my phone" New topic
Author

Accessing my web server URL fron my phone

james frain
Ranch Hand

Joined: Apr 06, 2011
Posts: 34
I have set up a very simple app to do a GET from a http server I have running on my pc. The GET just responds with a simple hello string. Initially I was having trouble accessing the url from the emulator as I was using localhost:8080 but read on this forum to use 10.0.2.2:8080 and it works fine from my emulator.
I don't know how this works but that's for another day
Now when I connect my phone via the usb, and install the apk file the app starts up fine but it never calls into my server. (I have the internet option switched on and can pull data back from google.co.uk if I use
request.setURI(new URI("http://www.google.co.uk"));
HttpResponse response = client.execute(request); )

Question is how do I talk to my web server running on my pc from the phone. Really stuck on this one and cannot find any worked example anywhere and this would be the final peice in the jigsaw before I get into the coding.
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 370
james frain wrote:I don't know how this works but that's for another day


If I get your problem correctly then this is the solution. You need to understand how addresses are routed and how hostnames are resolved to use the networking classes correctly. Some addresses are private and can't be reached from "outside" like your phone but only from "inside" the same subnet like the emulator.
 
 
subject: Accessing my web server URL fron my phone
 
Threads others viewed
pocket pc emulator on WebShpere??
Servlet speed
Tomcat 3.2.3 and JSP -- Please help
j2me app not working on device
it is possible to send data through an URL in the Sony Erics K300 phone ?
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture