Click here to Skip to main content
13,598,498 members
Rate this:
Please Sign up or sign in to vote.
See more:

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?


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
Posted 28-Dec-12 23:14pm
Updated 29-Dec-12 0:30am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:[^]

Here is the 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)
	End Sub
End Module
MehdiFadaei 29-Dec-12 5:50am
Yes, i want to write because this is a part of my program.
really the code which you supported dosnt work. at the moment my compter is connected to home group via wireless and also a device is connected to my computer via ethernet port. my computer ip for wireless is and for ethernet is
the connecterd devices to wireless: another computers: to 6
the connected device to lan

but this program is not able to find these devices
MehdiFadaei 29-Dec-12 6:25am
thanks but dosnt work anymore
Zoltán Zörgő 29-Dec-12 11:06am
is netstat showing you what you want?
Zoltán Zörgő 29-Dec-12 12:19pm
As I see, your question is wrong. What you want is not the list of devices connected to your computer, you want to list the devices connected to your networks. That is something else.
A device is connected to your computer if there is any socket opened between the remote device and your machine, that is what you can list this way, and that is what you asked for.
MehdiFadaei 29-Dec-12 13:52pm
Really you are right, iam looking for the devices which are connected to my networks. sorry. how can i solve it?
Zoltán Zörgő 29-Dec-12 15:36pm
Well, that's only a little bit more difficult. You have two possibilities:
1) If your router is capable of such reports, you can ask it.
2) If you have the address range, and that is low (as I see, you have two ranges with less than 255 addresses), you can try to ping all addresses one by one supposing that the devices are responding to icmp packets. Use:
2+) Here you have a little bit more delicate "nmap" like application, with c# source, you can get ideas:
Zoltán Zörgő 31-Dec-12 3:21am
Any progress?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03-2016 | 2.8.180621.3 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100