Click here to Skip to main content
11,644,284 members (65,716 online)
Rate this: bad
Please Sign up or sign in to vote.

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
Edited 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 at 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 at 29-Dec-12 6:25am
thanks but dosnt work anymore
Zoltán Zörgő at 29-Dec-12 11:06am
is netstat showing you what you want?
Zoltán Zörgő at 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 at 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ő at 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ő at 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
0 OriginalGriff 690
1 494
2 Sergey Alexandrovich Kryukov 429
3 Afzaal Ahmad Zeeshan 418
4 CPallini 336
0 OriginalGriff 925
1 DamithSL 636
2 Afzaal Ahmad Zeeshan 622
3 Sergey Alexandrovich Kryukov 548
4 CPallini 521

Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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