2012-03-14 50 views
0

有什麼辦法可以獲得WLAN信息f.e. SSID,信號強度等在Java或C + +?在Java/c + +中的Wlan SSID

我知道C++中的wlanscan函數。任何人都可以給我任何例子如何實現它?

還有一個java的jwlanscan api,但它不適合我。

操作系統:Windows 7

任何幫助,將不勝感激。謝謝!

編輯:

 { 
      System.loadLibrary("wireless"); 
     } 
     List list = getNetworkAdapterInfo(); 
     if (list == null) 
      System.out.println("None Network Adapter."); 
     else 
      for (Iterator ite = list.iterator(); ite.hasNext();) 
      { 
       NetworkAdapterInfo nic = (NetworkAdapterInfo)ite.next(); 
       System.out.println(nic.toString()); 
       List listap = getWirelessApInfo(nic.getName()); 
       if (listap == null) { 
        System.out.println("None Access Point."); 
       } 
       else { 
        System.out.println("Access Point:"); 
        for (Iterator ite1 = listap.iterator(); ite1.hasNext();) 
        { 
         WirelessApInfo ap = (WirelessApInfo)ite1.next(); 
         System.out.println(ap.toString()); 
        } 
       } 
       System.out.println(""); 
      } 

到目前爲止,我有這樣的代碼(jwlanscan API)。它不返回任何接入點。

+0

http://www.codeproject.com/Articles/21092/WLAN-Scan-with-NDIS-Miniport-and-Much-More ?? More ?? – 2012-03-14 10:01:24

+0

檢查下面的文章可能是有幫助的: > http://stackoverflow.com/questions/917910/how-to-find-a-list-of-wireless-networks-ssids-in-java-c-and- or-c – 2012-03-14 10:00:18

+0

@BogdanEmilMariesan:這不是java或C++。 :/ – HashimR 2012-03-14 11:57:02

回答

0

下面的帖子詳細介紹如何創建WLAN對象和訪問信息,你需要

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

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); 
} 

UPDATE:

OK,是我不好,

我想有對於wlan連接來說不是原生的java api。唯一的方法就是通過操作系統本地API來獲取信息。

+1

這不是java或C++。 :/ – HashimR 2012-03-14 10:10:05