查找连接到局域网的计算机的主机名和IP地址 [英] Find Host Name and IP Address of Computers Connected to LAN

查看:155
本文介绍了查找连接到局域网的计算机的主机名和IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Forms应用程序中查找使用C#连接到LAN的计算机的主机名和IP地址.

请帮助我.

Find host name and IP address of computers connected to LAN using C# in Windows Forms application.

Please help me.

推荐答案

您可以ping网络中的每个IP地址(可以通过子网掩码发现)并希望得到响应,或者您可以收听广播消息.
但是,如果计算机启用了防火墙,那么无论如何尝试都找不到他.

您可以要求Windows在cmd中键入"net view"(在这里查看如何使用C#完成此操作) [
Either you ping each IP-Address in your network (can discoverd by the subnetmask) and hope for response, or you listen to broadcast messages.
But if the computer has an enabled firewall you won''t find him whatever you try.

You could ask Windows with typing "net view" in cmd (look here how you can accomplish this with C#)[^].
Or maybe asking the router or dhcp-server could help...


第一步,除非您拥有局域网,然后在写作中获得所有者的许可.

如果您没有书面形式,那就不要这样做.
First step unless YOU own the lan then get the owner''s permission in writing.

If you do not have that in writing then do not do it.


这篇关于查找连接到局域网的计算机的主机名和IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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