Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing a WWAN connection on iPhone, even when Wi-Fi is available

I need to make a network connection over WWAN (i.e. the mobile network) on an iPhone, even when the device is connected to a Wi-Fi network, however I can't find a way to do this.

I've tried going down to the socket level and iterating through the available interfaces, however when connected to Wi-Fi, the WWAN interface (pdp_ip0) disappears.

The solution needs to be App Store safe.

like image 917
Andrew Ebling Avatar asked Dec 17 '09 08:12

Andrew Ebling


2 Answers

Enumerate the network interfaces, you will see that when you're connected on both wifi and 3g, there are 2 with different local ip addresses. You might be able to use one vs the other by forcing a bind of your socket on the right interface before sending the data. The kernel which tries to find the best interface to route your packet should be happy with your choice. Disclaimer: I have not tried this, this is just a suggestion.

like image 181
c0diq Avatar answered Sep 24 '22 00:09

c0diq


Perhaps you can use the Reachability code to determine if Wi-Fi is enabled, firing a UIAlertView to warn the users to quit the app, open the Settings app and switch off wireless manually. Not ideal, definitely.

like image 27
Alex Reynolds Avatar answered Sep 26 '22 00:09

Alex Reynolds