Scanning for Wi-Fi Networks

Top  Previous  Next

Scanning allows you to discover all networks in your device's range and also learn about their operating parameters, such as the name, RF channel, signal strength, etc. Two methods — wln.scan and wln.activescan — are provided for this purpose. Both methods are wln tasks and there is a certain correct way of handling tasks.

Wln.scan performs a passive detection of networks. During the passive detection, the hardware listens for "beacons" transmitted by wireless networks and extracts network information from these beacon packets. This method can't collect the network information of "hidden" wireless networks that do not broadcast their SSIDs (names).

Passive scanning is performed on all 14 frequency channels, regardless of the value of wln.domain. This is not in violation of any regulations because the passive scanning does not involve transmitting any data out of the device (the transmitter stays silent).

Wln.activescan actively "probes" the environment around the device by sending — you guessed it — "probe" packets. This method can find all the wireless networks that wln.scan would find, plus it can discover a hidden network, but only if you knew this network's name in advance.

Active scanning (sending of "probe" packets) is only performed on "allowed" channels. The list of allowed channels depends on the selected domain (wln.domain).

Scanning can be performed at any time, even when the Wi-Fi interface is in the associated state (wln.associationstate= 1- PL_WLN_ASSOCIATED) or running its own ad-hoc network (wln.associationstate= 2- PL_WLN_OWN_NETWORK). Keep in mind, however, that scanning temporarily disrupts communications between the device and the access point. This is because scanning involves checking for available access points on all (allowed) frequencies. Obviously, the radio can't keep communicating with the "current" access point while jumping from channel to channel.

Both wln.scan and wln.activescan accept a single argument of string type. Presence or absence of this argument defines the "operating mode" of these methods. You can either discover all wireless networks in range, or try to collect information about the specific network.


Also read about what happens when several access points have the same name.