如何获取连接到我的wifi的用户的IP列表 [英] How to get ip list of user who are connected to my wifi
问题描述
我想要连接到我的wifi的IP地址列表。
我尝试了什么:
使用System;
使用System.Collections.Generic;
使用System.ComponentModel;
使用System.Data;
使用System.Drawing;
使用System.Linq;
使用System.Text;
使用System.Windows.Forms;
使用System.Net;
使用System.Web;
命名空间WindowsFormsApplication6
{
公共部分类Form1:表格
{
public Form1()
{
InitializeComponent();
}
private void button1_click(object sender, EventArgs e)
{
string computerName = System.Net.Dns.GetHostName();
System.Net.IPHostEntry ipEntry = System。 Net.Dns.GetHostEntry(computerName);
System.Net.IPAddress [] ipAddress = ipEntry.AddressList;
computerName = computerName +| + ipAddress [0] .ToString();
listBox1.Items.Add(computerName);
listBox1.Items.Add(ipAddress);
}
}
}
i want the list of ip address who are connected to my wifi.
What I have tried:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Web;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_click(object sender, EventArgs e)
{
string computerName = System.Net.Dns.GetHostName();
System.Net.IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(computerName);
System.Net.IPAddress[] ipAddress = ipEntry.AddressList;
computerName = computerName + "|" + ipAddress[0].ToString();
listBox1.Items.Add(computerName);
listBox1.Items.Add(ipAddress);
}
}
}
推荐答案
这并不像你想象的那么简单:真正得到在列表中,您需要查询路由器,但具体操作方式与路由器不同。
还有另一个解决方案:如何以编程方式在C#中列出WLAN /路由器上的所有设备信息 [ ^ ] - 但它会相对较慢。
That's not as simple as you might think: to actually get the list, you need to query the router, but exactly how you do that will differ from router to router.
There is another solution though: How to List all devices info on your WLAN /router Programmatically in C#[^] - it will be relatively slow, however.
这篇关于如何获取连接到我的wifi的用户的IP列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!