简体   繁体   中英

Network operation fails after switching the network

I am using Core WLAN framework to switch between WiFi networks. I am facing a problem that after I switch from WiFi network 1 to WiFi 2, I have to wait for 10 seconds before I instantiate any network activity. Though the WiFi symbol shows the correct value before I put a wait for 10 seconds. Anyone has any clue as why this happens? And any remedy for this.

Core WLAN Framework link:

http://developer.apple.com/library/mac/#documentation/Networking/Reference/CoreWLANFrameworkRef/_index.html

There is no way to predict how long it will take to have a given network assign your system an IP address, for DNS resolution to begin to work, etc etc. Instead of waiting for a specific timeout, use the SCNetworkReachability API to take action when the system can access a given host or service.

Sample code: http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM