Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

It suddenly dawned on me that I couldn't answer a (seemingly) very simple networking question!

When a computer is in an area with mutiple LAN connections to choose from, how does it even see those networks in the first place (without being connected to them)?!?

Does the wirless card on my PC have some sort of "discovery" service that allows it to ping devices (?) for computer networks?

This is just an example of a feature that I've used (as a consumer) for years and never given 2 thoughts to!

Thanks in advance!

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

For wireless 802.11 ("Wi-Fi") networks, the access points (AP) simply broadcast an advertisement packet (the SSID) every few seconds, describing the wireless network they offer access to.

share|improve this answer
    
Thanks grawity - what component (on my laptop) is actually picking that broadcast up? The NIC? Something else? –  pnongrata Feb 6 '12 at 21:49
1  
The wireless NIC is receiving them, and the wireless configuration software is directing it to scan, collecting the results, and presenting them to you. –  David Schwartz Feb 6 '12 at 22:27
    
@Adam: The NIC. The beacon and data frames have the same outer format, the beacons are just consumed by the NIC. Some wireless NICs can be put into monitor mode in which they pass everything they receive, including beacon frames, as well as data from any surrounding networks (even those you aren't associated to). The Wireshark website has some documentation. –  grawity Feb 6 '12 at 22:48
1  
The advertisement packet is called the Beacon, not the SSID. Beacons are typically transmitted about 10 times per second, not every few seconds, and passively listening for Beacons is not the primary way 802.11 clients find their APs. –  Spiff Feb 7 '12 at 9:23
    
@Spiff: Thanks for the corrections. –  grawity Feb 7 '12 at 9:50
add comment

Most of the time, an 802.11 ("Wi-Fi") card will find networks by doing what's known as an "active scan". In an active scan, it tunes its radio to each channel it supports and transmits an 802.11 "Probe Request" packet, then stays on the channel for a few more milliseconds to receive "Probe Response" packets from any APs (Access Points -- the technical name for what most people call "wireless routers") on that channel. Because you can usually expect to receive all the Probe Responses you're going to receive within 40ms, cards can scan multiple channels very quickly.

In some cases, a card may choose to do a "passive scan" where it tunes to each channel and doesn't transmit anything, just listens for any Beacon frame transmissions from any APs on each channel. Listening for beacons can be time consuming because beacons are usually spaced 100ms apart, and could be even farther apart. So it can take more than twice as long to do a passive scan than to do an active scan.

In some regulatory environments, some channels have to be handled specially because they are not allowed to be used for Wi-Fi if there is a local radar installation using that channel. On those "radar channels", you must at least start out passively listening, but as soon as you see a Wi-Fi beacon from any AP on the channel you can assume there's no radar present and switch to an active scan.

Contrary to popular belief, passive scans are not the primary kind of scans (active scans are far more common). So although beacons also happen to be what make the AP findable in passive scans, the primary purpose of beacons is to coordinate timers between the AP and the clients, and to notify clients in power save mode that the AP has queued up packets for them (or that the AP is about to transmit queued up multicast/broadcast packets).

share|improve this answer
    
Maybe you also know the methods Bluetooth uses? I couldn't find any good documentation on that and it would still fit this question. –  grawity Feb 7 '12 at 11:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.