PDA

View Full Version : Is it possible to choose a wi-fi connection from within an application?




lilmul123
Jul 27, 2009, 11:02 AM
I would like to be able to change to different wi-fi connections from within my application; is this possible? If so, how?

Also, is there a way to determine the IP of the connection I am currently connected to within my app?



lilmul123
Jul 27, 2009, 08:08 PM
Is this not possible?

moral-hazard
Jul 27, 2009, 08:11 PM
Is this not possible?

I would tend to doubt the ability to switch wi-fi connections within the app.
As for getting the IP address, there is definitely a way. I don't (explicitly) know that apple offers a way to do this internally.

A "hacky" way to do it would be to grab the source code of one of the pages that tells you your IP address (like IPChicken), since it would show up in the HTML source. Obviously this would only work when you are connected, but you would only have an IP when you are connected to the internet, but I would assume that 99% of the time you are connected to a WiFi connnection, you would be so that's not really a concern.

Obj-C doesnt offer much in the way of regular expressions, but you could certainly parse it out somehow. Be creative.