本文介绍了如何以编程方式连接到 Windows 10 中的隐藏 SSID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这上面花了很长时间,但我被困住了.
我正在尝试以编程方式连接到已知的隐藏 SSID.

我正在使用以下代码

await firstAdapter.ScanAsync();WiFiAvailableNetwork 网络 = firstAdapter.NetworkReport.AvailableNetworks.FirstOrDefault(n => n.Ssid == ssid);

问题是我需要首先提供 WiFiAvailableNetwork 类型的对象,但 AvailableNetworks 只带回非隐藏的 SSID.

public IAsyncOperationConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, String ssid)

以上代码与非隐藏 SSID 完美配合.
是否有连接到隐藏 SSID 的 API?
谢谢

解决方案

如果可用,隐藏网络应该在 firstAdapter.NetworkReport.AvailableNetworks 列表中.

由于 SSID 被隐藏,目标网络的 WiFiAvailableNetworkSsid 属性将为 "".

您可以在此处进行假设并尝试使用以下方法连接到它:

await firstAdapter.ConnectAsync(networks.First(x => x.Ssid == ""), WiFiReconnectionKind.Automatic, "password", "knownSSID");

I have spent ages on this and I am stuck.
I am trying to connect to a known hidden SSID programmatically.

I am using the following code

await firstAdapter.ScanAsync();

WiFiAvailableNetwork network = firstAdapter.NetworkReport.AvailableNetworks.FirstOrDefault(n => n.Ssid == ssid);

The problem is I need to supply as a first an object of type WiFiAvailableNetwork but AvailableNetworks only brings back non-hidden SSIDs.

public IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, String ssid)

https://docs.microsoft.com/en-us/uwp/api/windows.devices.wifi.wifiadapter.connectasync#Windows_Devices_WiFi_WiFiAdapter_ConnectAsync_Windows_Devices_WiFi_WiFiAvailableNetwork_Windows_Devices_WiFi_WiFiReconnectionKind_Windows_Security_Credentials_PasswordCredential_System_String_

The above code works perfectly with non-hidden SSID's.
Is there an API to connect to a hidden SSID?
Thanks

解决方案

If available, the hidden network should be in the firstAdapter.NetworkReport.AvailableNetworks list.

As the SSID is hidden, the Ssid property of WiFiAvailableNetwork for the target network will be "".

You could make an assumption here and attempt to connect to it using:

await firstAdapter.ConnectAsync(networks.First(x => x.Ssid == ""), WiFiReconnectionKind.Automatic, "password", "knownSSID");

这篇关于如何以编程方式连接到 Windows 10 中的隐藏 SSID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 15:44