i am having difficulties to have my android app running in the emulator to connect to servers in my local network. i am getting a


but the servers are resolvable fine from the machine where the emulator is run.

thanks for any help on this topic!

Recommended Answers

All 8 Replies

You need to give it your machine local IP not localhost or

hi i"ve done my search and i know that refers to the android loopback interface so if instead of localhost or i should use the thing is that my URL doesn't include my machince ip or anything like that.For example the url that i want to refer to is in this format: http://server1:81/wcf.svc and my application cannot resolve server1 because it's only a local server.It would access it normally if my sever would be on internet.

Is what your ipconfig command returned in terminal? I would have expected something along the line of 192.168.1.x where x can be any number between 0-255.
Bellow is output from my Mac, en1 one shows that my IP on wireless network is

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    inet netmask 0xff000000 
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
    ether 60:fb:42:f0:47:e4 
    media: autoselect
    status: inactive
    lladdr 60:fb:42:ff:fe:f0:47:e4 
    media: autoselect <full-duplex>
    status: inactive
    ether 00:26:bb:15:5c:e0 
    inet6 fe80::226:bbff:fe15:5ce0%en1 prefixlen 64 scopeid 0x6 
    inet netmask 0xffffff00 broadcast
    media: autoselect
    status: active

no is what my virtual device considers that my developing machine's ip is...but still i don't want to connect it in my machine but in a server which my machine is connected to...

You need to provide IP of the machine on which server is running, and not some fictional IP that people mentioned on internet as example. When you get that IP you will be able to call localhost:8080/index.html as for example

yes what i'saying here is that the url of my webservice doesn't include my localhost.Also i know the ip of the local server.In my search i found out that i should open the emulator with and option of -dns-server <server/ip address> and hopefully it should work

Somebody configured server you trying to use and set it. That someone said when I call server1:81 I'm calling IP (just example). It is like daniweb.com is actually So find IP of that server for the network and use IP of it.

Sorry for confusion, but I misread your original post and asumed that we are talking about local server

ok the way I found out was the following: executing the emulator from the cmd and then and adding the -dns-server xxx.xxx.xxx.xxx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.