tags:

views:

288

answers:

1

Suppose, if I'm able to connect to wifi as well as 3G, can I write the code to connect to a website using 3G (not through wifi) or vice versa?

A: 

I don't think this is something that you can do programatically using the iPhone SDK. The choice of what network interface is used is pretty "black box", and doesn't have any API.

However, I do believe that if a connection is started while using 3G, and WiFi becomes available (and auto connects), then that connection will continue using 3G for the rest f its lifespan. All new connections will use the WiFi.

Jasarien
Thanks for the information and clarification.
Satyam svv
OK. Atleast is it possible to find whether I'm receiving data via Wifi or 3G. In short can I find whether my network is connected to 3G or wifi?
Satyam svv
This sample code contains the Reachability class that a lot of iPhone devs use to determine what type of data connection the iphone is currently on. It can also be used to check whether or not particular hosts can be reached and via which networks they can be reached from. http://developer.apple.com/iphone/library/samplecode/Reachability/Introduction/Intro.html
Jasarien