在C ++中获取当前连接的网络名称(SSID) [英] Obtaining currently connected network name (SSID) in C++

查看:879
本文介绍了在C ++中获取当前连接的网络名称(SSID)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取计算机当前连接到的无线网络的名称(SSID).我已经研究了IP Helper API,但它似乎具有所有功能(DNS服务器,IP地址..).任何帮助,将不胜感激.

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.

推荐答案

这取决于操作系统,最简单的方法可能是仅将Shell脱壳并执行系统的netsh或等效程序,然后对结果进行grep

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

例如在Windows上,"netsh wlan show int"给出了

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

这篇关于在C ++中获取当前连接的网络名称(SSID)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆