I would like to obtain the name (SSID) of the wireless network that the computer is currently connected to. I've looked into the IP Helper API but it seems to have everything but that (DNS servers, IP addresses..). Any help would be appreciated.
It's OS dependant, the easiest way may be to just shell out and exec the system's netsh or equivalent and then grep the result
eg. on windows 'netsh wlan show int' gives
There is 1 interface on the system:
Name : Wireless Network Connection
Description : Broadcom 802.11g Network Adapter
GUID : 1de52c34-2e59-46c4-ae8d-8d442c44dfd
Physical address : 00:00:56:b6:ad:00
State : connected
SSID : xxx
BSSID : 00:00:5b:27:83:ea
Network type : Infrastructure
Radio type : 802.11g
Authentication : Open
Cipher : WEP
Connection mode : Auto Connect
Channel : 6
Receive rate (Mbps) : 54
Transmit rate (Mbps) : 54
Signal : 90%
Profile : xxx
Hosted network status : Not started
You need to use the Native wifi API. You can find samples here (including query SSID as you asked).
来源:https://stackoverflow.com/questions/4683545/obtaining-currently-connected-network-name-ssid-in-c