问题描述
我设计一款Android应用,将需要在本地设备上使用的Web服务器。我一直在尝试一些不同的服务器用于此目的。在present我没有写任何code或在模拟器中运行任何东西,只是用我的实际手机上的服务器发挥各地,而且我观察一些奇怪的行为。
I'm designing an Android app that will require the use of a web server on the local device. I've been trying out some different servers for this purpose. At present I haven't written any code or run anything in an emulator, just played around with the servers on my actual phone, and I'm observing some strange behaviour.
每当我尝试连接到本地Web服务器,我有WIFI关掉,HTTP请求失败。如果我切换WIFI上,它成功。
根据我用的地址,我得到不同的结果:使用本地主机或127.0.0.1,我得到WIFI时是关闭的连接被拒绝;使用当前10.X.Y.Z地址,我收到了超时。这两个地址工作的时候WIFI开启。
Whenever I try to connect to the local web server, and I have WIFI switched off, the HTTP request fails. If I switch WIFI on, it succeeds.Depending on which address I use, I get different results: using localhost or 127.0.0.1, I get connection refused when WIFI is off; using the current 10.X.Y.Z address I get a timeout. Both addresses work when WIFI is on.
我跟XWS,PAW和i-码头试过这样的:行为是一致的。 WIFI,我可以连接到本地Web服务器; WIFI的时候,我不能。
我使用的是默认的互联网浏览器在Android 2.3.3对三星Galaxy S(GT-I9000)。
I have tried this with xWS, PAW and i-Jetty: the behaviour is consistent. WIFI on, I can connect to the local web server; WIFI off, I can't.I am using the default "Internet" browser on Android 2.3.3 on a Samsung Galaxy S (GT-I9000).
有谁知道这是为什么?它是一个设置的地方我需要改变,或者一个简单的问题是怎么回事?
Does anyone know why this is? Is it a simple question of a setting somewhere I need to change, or what's going on?
干杯,
/ Uffe
推荐答案
现在我已经用我自己的简单的客户端进行测试,并与歌剧 - 和它的作品
I have now tested with my own simple client, and with Opera - and it works.
所以其实这是不符合IP堆栈,但与默认的Android浏览器的问题,或可能由制造商(三星)或载体(瑞典Telenor)执行的设置。无论哪种方式,有解决方法:使用Opera而不是
So in fact this is an issue not with the IP stack but with the default Android browser, or possibly with the settings enforced by the manufacturer (Samsung) or carrier (Telenor Sweden). Either way there is a workaround: use Opera instead.
不过不知道为什么它不使用默认浏览器中工作,但我会庆祝这个问题的回答。
Still don't know why it doesn't work with the default browser, but I'll mark this question answered.
这篇关于Android和QUOT;本地主机"插座时失败没有数据连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!