找出连接的设备IP地址 [英] Findout connected devices IP adresses

查看:153
本文介绍了找出连接的设备IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想编写一个vb程序来查找所有已连接的网络设备到我的电脑。

所有设备都是连接到我的电脑使用IPv4,我正试图找到设备IP地址。



我该怎么办?



非常感谢



也许你没有动静,我需要真的,

我需要一个连接的物理设备列表和IP到我的电脑,而不是本地电脑的程序和服务

解决方案

你真的想自己写吗?

由于外面有很多免费工具,能告诉你这个。请参阅 Sysinternals TCPview [ ^ ]例如,或内置的Windows工具 NETSTAT [ ^ ]。



但它真的不复杂,看看这篇文章:

http://towardsnext.wordpress.com/2009/02/09/netstat-in- c / [ ^ ]



[更新]

以下是它的vb.net版本:

 进口系统
进口 System.Net
Imports System.Net.NetworkInformation

模块程序
Sub Main()
Dim ipProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()

Dim endPoints As IPEndPoint() = ipProperties.GetActiveTcpListeners()
Dim tcpConnections As TcpConnectionInformation()= ipProperties.GetActiveTcpConnections()

对于 每个 info As TcpConnectionInformation tcpConnections
Console.WriteLine( Local:& info.LocalEndPoint.Address.ToString()& & info.LocalEndPoint.Port.ToString()& vbLf& 远程:& info.RemoteEndPoint.Address.ToString()& & info.RemoteEndPoint.Port.ToString()& vbLf& 状态:& info.State.ToString()& vbLf& vbLf)
下一步
Console.ReadLine()
结束 < span class =code-keyword> Sub
结束 模块


Hi,

I want to write a vb program to find all connected network devices to my computer.
all devices which is connected to my computer use IPv4 and am trying to find the devices IP adresses.

how can i do?

thanks

Maybe you didnt undrestand whaat i need really,
I need the a list and ip of physical devices which is connected to my computer, not the program and services of local computer

解决方案

Do you really want to write it for yourself?
Since there are lots of free tools outside, able to tell you this. See Sysinternals TCPview[^] for example, or the built-in windows tool NETSTAT[^].

But it is really not complicated at all, check out this article:
http://towardsnext.wordpress.com/2009/02/09/netstat-in-c/[^]

[Update]
Here is the vb.net version of it:

Imports System
Imports System.Net
Imports System.Net.NetworkInformation

Module Program
	Sub Main()
		Dim ipProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()

			Dim endPoints As IPEndPoint() = ipProperties.GetActiveTcpListeners()
			Dim tcpConnections As TcpConnectionInformation() = ipProperties.GetActiveTcpConnections()

			For Each info As TcpConnectionInformation In tcpConnections
				Console.WriteLine("Local : " & info.LocalEndPoint.Address.ToString() & ":" & info.LocalEndPoint.Port.ToString() & vbLf & "Remote : " & info.RemoteEndPoint.Address.ToString() & ":" & info.RemoteEndPoint.Port.ToString() & vbLf & "State : " & info.State.ToString() & vbLf & vbLf)
			Next
			Console.ReadLine()
	End Sub
End Module


这篇关于找出连接的设备IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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