在与我的计算机相同的网络中获取所有IP

编程入门 行业动态 更新时间:2024-10-28 15:31:30
本文介绍了在与我的计算机相同的网络中获取所有IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有办法以编程方式(在C#中)获取与我的计算机在同一域/子网中的所有其他工作站,并显示有关它们的一些信息(如果它们处于活动状态,安装了哪种操作系统, IP等)?

Is there any way to programatically (in c#) get all the other workstations that are in the same domain/subnetwork as my computer and display some information about them (if they are active, what kind of OS they have installed, their IP etc)?

推荐答案

这是VB解决方案,但是我敢肯定,您将能够进行所需的更改以使这项工作有效!

This is a VB solution, but I'm pretty sure you'll be able to make the changes you need to make this work!

可能有更好的方法,但这是第一次切入.

There's probably a better way, but this was a first cut.

Imports System.Net.NetworkInformation Imports System.Directory Services Class NetworkInfo Function GetComputers() as list(Of String) dim List as new list(of String) Dim DomainEntry as new DirectoryEntry("WinNT://" + DomainInfo.GetDomain.Trim()) DomainEntry.Children.SchemaFilter.Add("computer") For Each Machine as DirectoryEntry in DomainEntry.Children List.Add(Machine.Name) Next return List End Function End Class

System.Net.NetworkInformation命名空间中提供了各种有用的工具,可让您捕获IP地址等内容.

There are all sorts of useful tools knocking about in the System.Net.NetworkInformation namespace to let you capture things like the IP address, etc.

更多推荐

在与我的计算机相同的网络中获取所有IP

本文发布于:2023-06-08 15:36:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/583969.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:在与   计算机   网络   IP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!