How to find a list of wireless networks (SSID's) in Java, C#, and/or C?

前端 未结 3 1715
深忆病人
深忆病人 2020-12-04 17:03

Is there a toolkit/package that is available that I could use to find a list of wireless networks (SSID\'s) that are available in either Java, C#, or C for Windows XP+? Any

3条回答
  •  臣服心动
    2020-12-04 17:55

    For C#, take a look at the Managed Wifi API, which is a wrapper for the Native Wifi API provided with Windows XP SP2 and later.

    I have not tested this code, but looking at the Managed Wifi API sample code, this should list the available SSIDs.

    WlanClient client = new WlanClient();
    foreach ( WlanClient.WlanInterface wlanIface in client.Interfaces )
    {
        // Lists all available networks
        Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList( 0 );
        foreach ( Wlan.WlanAvailableNetwork network in networks )
        {                     
            Console.WriteLine( "Found network with SSID {0}.", GetStringForSSID(network.dot11Ssid));
        }
    }
    
    static string GetStringForSSID(Wlan.Dot11Ssid ssid)
    {
        return Encoding.ASCII.GetString( ssid.SSID, 0, (int) ssid.SSIDLength );
    }
    

提交回复
热议问题