Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Connect to server on LAN

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I have an application that connects to server for basic verification and fetching data.Web Service is in Java.
The problem is that i am not able to connect to the web service through Emulator as well as device via USB or Wifi.I tried via both application and browser.

Is it possible to do so in Android or else I will have to use live IP.

And yes Its accessible via browser on LAN.

Thanks and Regards,
Vishal Trivedi
 
Saloon Keeper
Posts: 7089
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The emulator can connect to the machine it's running on, but not the network that machine is on. It would use a special IP address for that.

A device can connect to the machine it's connected to via USB, but not the network that machine is on. It would use a special IP address for that.

A device should have no problem to connect to a network through WIFI, though.
 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim

I last thing i guess the ip address on n.w doesn't has to be special.
Can get it from ipconfig....

 
Tim Moores
Saloon Keeper
Posts: 7089
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I don't understand what you're trying to say.
 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean to say like 10.0.2.2 is used instead of 127.0.0.1

Am i supposed to use other Ip (apart from what i get on "ipconfig")


Thanks
 
Tim Moores
Saloon Keeper
Posts: 7089
165
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly, you'd use 10.0.2.2 and 10.0.1.2 (I think) for the first two scenarios I mentioned. For the 3rd scenario you'd use whatever IP address the target server has.
 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks you it worked....

Now i have a new problem....

When I send data to server the server receives a null string....
Logs on my side are correct...
Its just a simple servlet that mirrors back my string



I dont seem to get it.....
 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found out it was the name of the parameter that I had enetered was diff for request.getParameter() and new BasicNameValuePair("json", mJSON)

Thanks
 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And i thing i figured out was that app was running on Emulator and my app-server was accessed on n/w.
 
Screaming fools! It's nothing more than a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic