开发者

How to control whether iOS uses 3G/GSM network of WiFi for HTTP request

开发者 https://www.devze.com 2023-03-30 04:27 出处:网络
I have a strange behavior on my iOS device when connecting to a local web server via HTTP and WiFi. Here\'s the setup:

I have a strange behavior on my iOS device when connecting to a local web server via HTTP and WiFi. Here's the setup:

  • The iOS device is connected to a local WiFi network with no internet connectivity. A small embedded web server is connected to the same WiFi network and I want to connect to that web server via HTTP. The response times of this web server varies between 0.2 and 2 seconds.
  • The iOS device is also connected to a 3G network with internet access.

In this setup, the majority of HTTP requests time out after the default time interval of 10 seconds with no response whatsoever. When I turn off the 3G network by turning on Airplane mode and selectively enabling WiFi again, not a single request is dropped anymore. It's almost as if the iOS tries to connect to the local web server via the 3G network most of the time (but not always) wh开发者_开发知识库ich, of course, must fail.

From what I understand, there is no way of controlling which network interface is used by the iOS device. I'd appreciate to hear your opinion and experiences with this setup.

Thanks in advance and cheers, Georg


Is the local WWW server running within the same network as your WLAN card in your iOS device? If not, configure things so that they are, then the IP stack will know not to attempt to send "local" traffic to the 3GPRS card, but to the WiFi card instead (it'll have a default route set up for that local network and will route traffic accordingly)


It appears there's no way of controlling this interface. I guess it even makes sense architecturally. I did investigate the problem of dropped packets a little more and like to share the results. After a lot of testing, my conclusion is that the 3G hardware on the iPhone 4 is interfering with the WiFi hardware (or software). The problem did not occur on the iPhone 3GS or an iPad1 3G. Time for the iPhone 4GS.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号