Re: [android-developers] 127.0.0.1 Connection refused when not connected to WiFi
Use 10.0.0.2 instead of localhost or i.p.address. This will work.
Thanks
Naveen Gayar
On Fri, Jul 15, 2011 at 1:46 AM, Uffe <swedishsax@gmail.com> wrote:
Hi!
I am writing a service app which needs to be accessed from a browser
(on the same device, never remotely) and whose URL needs to be
http://127:0.0.1:<port>. I cannot use any other IP address.
The problem is that when I direct the browser to the URL, it fails
with a Connection Refused error if I don't have a WiFi connection. I
have tried this with my own simple server, with xWS, PAW and i-Jetty,
all behave the same way: if there is no WiFi connection, the
connection is refused.
I have verified that my server never gets a connection request in this
case. It gets stopped before it gets to me, the question is where and
why?
I have checked the routes and the network interfaces.
When there is no WiFi connection, the device has a pdp0 interface;
when there is a WiFi connection, the device instead has an eth0
interface.
The lo interface (127.0.0.1) exists in both cases, and there is no
route to 127.0.0.0 in either case.
In other words, the network configuration appears to be identical in
the two cases, differing only in which network interface is present.
Interestingly, when I run my app on the emulator, it works. It only
fails on the real device, which is a Samsung Galaxy S running 2.3.3
(not rooted).
It seems to me that the IP stack fails to route correctly when WiFi is
disconnected.
Is this a bug in the stack?
Cheers,
/Uffe
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home