获取相互连接的计算机信息 [英] Get Computer Information that was connected to each other

查看:44
本文介绍了获取相互连接的计算机信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取连接到我电脑的电脑的信息?它是计算机名称和 IP 地址.我使用 C# 作为我的编程语言

how can I get the information of computer that is connected to my computer? it's computer name and it's IP address.. I am using C# as my Programming Language

我用交叉线连接两台电脑.

I am using cross cable to connect the two computer.

推荐答案

您应该知道的第一件事是,当您将某物连接到以太网时,无论是否使用交叉电缆,该网络上的设备实际上并不需要发送任何东西.没有消息说哦,我是这个网络的新手,介意把我介绍给邻居吗?"

The first thing you should know is that when you connect something to an Ethernet network, crossover cable or not, the devices on this network aren't required to actually send anything. There is no message that says "Oh I'm a new to this network, care to introduce me to the neighbors?"

话虽如此,当连接设备时通常会出现一系列活动.在大多数网络上,有一种叫做 DHCP 服务器的东西可以发送配置,例如 IP 地址、网络掩码、DNS 服务器地址等.同样,这不是配置要求.许多设备是手动配置的,不使用 DHCP.网络通常不需要使用 DHCP.但是,这是一个好的开始.

That being said, there is usually a flurry of activity when a device is connected. On most networks, there is something called a DHCP server that sends out configuration, such as IP address, netmask, DNS server addresses, etc. Again, it isn't required that this is the configuration. Many devices are manually configured and don't use DHCP. Networks in general are not required to use DHCP. But, it is a good start.

您需要做的是一些数据包嗅探.基本上,编写软件来侦听通过您的网络接口的所有数据包,并过滤出您感兴趣的数据包.有一个 Winpcap 的.NET 包装器,它是 Windows 的数据包捕获驱动程序.这应该可以帮助您入门.

What you need to do is a bit of packet sniffing. Basically, write software to listen for all packets coming across your network interface, and filter out for the packets you are interested in. There is a .NET wrapper for Winpcap, which is a packet capture driver for Windows. This should get you started.

侦听设置为以太网广播的数据包 (FF:FF:FF:FF:FF:FF).在 IP 网络上,您可以使用 ARP 来获取该主机的 IP 地址.

Listen for packets set to the Ethernet broadcast (FF:FF:FF:FF:FF:FF). On an IP network, you can use ARP to get the IP address of that host.

Windows 网络信息也通过广播发送,如果您感兴趣的话.

Windows network information is also sent via broadcast, if that interests you.

要了解您要查找的内容,请下载 Wireshark 并查看.

To get an idea of what you're looking for, download Wireshark and take a look.

这篇关于获取相互连接的计算机信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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