如何获取连接到路由器网络的所有设备的列表?

时间:2016-12-09 21:11:51

标签: c# .net winforms networking wifi

使用此代码我得到4个结果。 但在我的无线网络中,我还使用网线连接了我的Playstation 4,但它没有列出。

我得到的List设备是:“Ethernet”,“Loopback Pseudo-Interface 1”,“isatap。{73CD0753-A107-4E2A-9DCD-A8BDFF1C863B}”,“Teredo Tunneling Pseudo-Interface”

当我登录DHCP客户端上的路由器设置时,我只看到顶部:DESKTOP-Q1B0IV9 00:24:1d:c6:46:b2 10.0.0.1然后在第二个没有名称但只有:00 :d9:d1:b8:30:1c 10.0.0.5

我的路由器是D-Link N600,PlayStation 4通过网线连接到装载机。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using SharpDX;
using SharpDX.DirectInput;
using System.Net.NetworkInformation;
using System.Threading;
using System.Diagnostics;

namespace Ps4_Controller
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            List<string> devices = new List<string>();
            NetworkInterface[] niArr = NetworkInterface.GetAllNetworkInterfaces();
            Console.WriteLine("Retriving basic information of network.\n\n");

            foreach (NetworkInterface tempNetworkInterface in niArr)
            {
                devices.Add(tempNetworkInterface.Name);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

0 个答案:

没有答案
相关问题