Can I use only cellular network (3G or EDGE), even if WIFI is connected on the iPhone? - iphone

I was wondering whether I can use the cellular network (3G or 2G or whatever they may have) even if the WIFI is connected and working.
I noticed that Apple has a "Reachability" sample code, but that would only tell me if I can connect using a cellular network; instead, I would like to actually use ONLY the cellular network.
Best Regards,
Noam.

Definitely YES. You should combine Reachability notifications with network interfaces enumeration. And - this point is much important: use BSD socket's bind() call to bind to CONCRETE IP address. Don't use 0.0.0.0 and your app will be network-adaptive and awaring. My poor gist example: https://gist.github.com/avesus/fdb465b60a4f5204845c

No, I wouldn't imagine so.
My understanding is that if the device is connected to Wifi, 3G is not used for data and all data traffic travels via Wifi.
Only cellular data to another cellular device would use the phone provider's network.

I believe that the only way to accomplish this would be to detect if the user is on WiFi (example code is in the "Reachability" example you cited), and if so, prompt them to disable WiFi prior to using your app.

Related

How to get cellular carrier List from my iphone app assign one from them manually from application itself

Is there a way may be using private APIs to obtain the complete list of available Cellular networks and assign one manually from my application itself.
Any help is appreciated
No.
Apple is very protective of that kind of thing - an app can't manually assign either a cellular or wireless network for the device to connect to. There is a special chip in the device that handles cellular connections, and only the user can control WiFi connections.

Network Link Conditioner can not work together with Reachability?

Network Link Conditioner is the develop tool provided by Apple, but seem like not work together with the other tool Reachability.
Network Link Conditioner is the tool to simulate 3G/Edge/Wifi network cases.
Reachability is to recognize the different network cases.
Anyone has such experience to make them work together ?
You shouldn't have any issue with Reachability since it really just tells you whether or not you have a network connection, not how well it is functioning. The only difference is between Wifi and Cellular, not between different speeds or cellular connections.
Reachability doesn't test the speed of the network to determine what kind it is. Reachability is about availability of interfaces (airplane mode vs. not, wifi on / off).
Important note:
A remote host is considered reachable when a data packet, sent by an application into the network stack, can leave the local device. Reachability does not guarantee that the data packet will actually be received by the host.
From Apple's SCNetworkReachability documentation.

Detecting wifi network change in iPad

I have an iPad application which requires me to stream a video to a user only if he is connected to a particular wifi network. If his wifi network changes, I need to stop streaming.
Is there any way to know that the wifi network that the user is connected to has changed?
Are there any public APIs that can give me the SSID of the wifi network I am connected to or the VSS ID or the MAC address of the router?
Thanks and Rgrds,
Hetal
There is no supported way to do this, but it is possible.
See this question for more details:
Accessing iPhone WiFi Information via SDK

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.
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.
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.
There is no supported way to to do this. You need to tell the user to turn off the WiFi connection since "It's a non-negotiable operational requirement for the service the app needs to connect to."
In this scenario, the user is not likely to kill you with bad reviews if you are clear about why they have to disable WiFi.
-t

How to list all devices in my wifi range in iphone

I am using the reachability code from apple to find if my iphone is connected to the wifi. Next i would like to list all the devices that are in my wifi range. How should i do this. The other devices do not publish any service. I want to detect all devices in my wifi range and send that device a request for tcp connection.
If a device does not advertise its presence and is not otherwise active, TCP/IP does not give you a way to "detect" it. If you can identify your subnet (which has nothing to do with a "wifi range", whatever that may be), you can try connecting to each possible host in it on all possible ports -- this is generally considered an attack (what legitimate reason could you have for such a port scan?), so, if you're detected trying this attack, be prepared for the consequences.
As #Alex says, even if you could find devices that weren't advertising, what's the point? You can't most likely do any adhoc communications with them. Instead you'd need to find copies of your application running on connected devices, and your app needs to advertise.
Take a look at Gamekit sample projects which will give you bluetooth connectivity, and you could dig into something like Jens Alfke's MyNetwork and Blip libraries for tcp/wifi. http://jens.mooseyard.com/2008/05/blip-come-n-get-it/