如何使用VB.NET连接到接入点? [英] How to connect to access point using VB.NET?

查看:110
本文介绍了如何使用VB.NET连接到接入点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在互联网上搜索了几周了.
有什么方法可以通过VB.NET连接到网络/路由器/访问点吗?
我不太在乎该程序是否需要管理权限.
我已经制作了一个程序,其中列出了范围内的访问点.
我的程序的目的是在BT Openzone或FON热点范围内连接到它.
我正处于程序找到范围内访问点的位置.
现在,我对API不太满意,因此,如果您将我引荐给我,可以给我更多或更少的逐步说明如何使用它(例如,将此文件放在app目录中,添加对此文件的引用)文件)

这是我当前的代码:

I have been searching the internet for weeks now.
Is there a way I can connect to a network/router/access point through VB.NET?
I don''t really care if the program needs administrative privileges.
I have already made a program which lists the access points in range.
The purpose of my program is to, when in range of a BT Openzone or FON hotspot, to connect to it.
I am at the point where the program has found a access point in range.
Now, I am not that good with APIs, so please if you refer me to one can you give me more or less step by step instructions what to do with it (eg. put this file in the app directory, add a reference to this file)

Here is my current code:

Private Function RetrieveNetworks()
Dim proc As New Process
proc.StartInfo.CreateNoWindow = True
proc.StartInfo.FileName = "netsh"
proc.StartInfo.Arguments = "wlan show networks mode=ssid"
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.UseShellExecute = False
proc.Start()
Return (proc.StandardOutput.ReadToEnd())
proc.WaitForExit()



我设法过滤了输出,因此我得到了一个完全干净的SSIDS列表.
任何帮助,我将不胜感激.



I have managed to filter the output so I get a perfectly clean list of SSIDS.
Any help and I would be very grateful.

推荐答案

您实际上并不是在编写程序来获取SSID列表并连接到它们.如果真是这样,您将使用无线网络API.

您正在编写一个程序,询问另一个程序什么是SSID列表.

好了,您可以使用相同的技术来使NETSH联网以连接到另一个SSID.该命令将类似于:
You''re not really writing a program to get a list of SSIDs and connect to them. If that was the case, you''d be using the Wireless Network API.

You''re writing a program to ask another program what the list of SSIDs are.

Well, you can use the same technique to net NETSH to connect to another SSID. The command would look something like:
netsh wlan connect name={profile name} ssid={ssid to connect}


当然,您首先需要配置文件名称.这意味着您必须使用命令


Of course, you need the profile name first. This means you have to use the command

netsh wlan show interfaces


并解析结果以获取名称",无线电类型"和配置文件"字段.单选类型将为您提供尝试使用的界面.毕竟,您无法在蓝牙接口上连接到802.11g SSID.

拥有该表后,您可以使用上面列出的Connect命令以及该表中的信息.


and parse the result to get the Name, Radio type and Profile fields. The radio type will give you which interface to try and use. After all, you can''t connect to an 802.11g SSID on a Bluetooth interface.

Once you have that table, you can use the Connect command as layed out above with the information in the table.


这篇关于如何使用VB.NET连接到接入点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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