473,473 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Network Discovery

Ive been experimenting with ways to discover computers on the network.

Most of what I have tried is centered around looping through our network
address ranges to discover the names of the computers up and running on
the network.

I have tried this using UDP sent to port 136 and retrieving the name of
the machine. I have also attempted doing this using WMI.

The problem I had with UDP is that it isnt reliable, and can be quite
slow when getting replies from a wireless host and I wind up loosing
results.

WMI works reliably, but is very slow when the ManagementScope object
returns with an exception. It appears when it cannot make a connection
to an IP address it takes 42 seconds for it to return and move on to the
next address. Is there a way to speed this process up? Would I be
better off throwing each of these IP address querys into its own thread
and waiting for all the threads to return???

This is the code I have now:

ManagementScope mS;
ObjectQuery oQ;
ManagementObjectSearcher search;
ManagementObjectCollection result;
ConnectionOptions options = new ConnectionOptions();
options.Timeout = TimeSpan.FromSeconds(10);
// Scan the network
for (int i = 1; i < 255; i++)
{
mS = new ManagementScope("\\\\10.1.54." + i.ToString() +
"\\root\\cimv2", options); Console.WriteLine("IP Address
Connecting To: 10.1.54.{0} at {1} Timeout {2}",
i.ToString(), DateTime.Now.ToString(),
options.Timeout.TotalSeconds.ToString());
try
{
mS.Connect();
}
catch
{
Console.WriteLine("Error!!!! at {0}",
DateTime.Now.ToString());
}
if (mS.IsConnected == true)
{
oQ = new ObjectQuery("select * from
Win32_ComputerSystem"); search = new
ManagementObjectSearcher(mS, oQ);
result = search.Get();
foreach (ManagementObject info in result)
{
Console.WriteLine("Computer name {0}",
info["Name"]);
}
oQ = null;
search = null;
result = null;
}
mS = null;
}

Feb 8 '07 #1
0 4369

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Anurag | last post by:
Hi, I understand that the dbm cfg parameter "DISCOVER" controls whether Search or Known discovery is applicable. Additionally, Search discovery provides a superset of Known discovery. I completely...
0
by: Kevin L | last post by:
I am looking to incorporate network device discovery into a Help Desk application that I am building. As I have never done this before, I am looking for some help. Can anyone share any web site...
0
by: serge calderara | last post by:
Dear all, Let say that I have developped a web service which is host on Server1. Then one of my customer will like to used that service in its own web site which is not based on .NET platform. ...
22
Red½
by: Red½ | last post by:
hello, i still cannot network my new vista cpu with my other xp computer in my house. on Network Connection on vista the "View Map" it sees both computers but its not hooking them up, can anyone...
0
by: BLUE | last post by:
Enable and Disable in the Network and DialUp Connections manager is actually setting a bit in the registry for the target adapter and then calling NDIS to unbind or bind (depending on whether your...
2
by: mascomkt | last post by:
I had a three station XP network with a NAS attached that worked fine. Then I replaced one of the PCs with a Vista computer. The Vista PC which has a USB Linksys WiFi and can connect to the...
1
by: martin lanny | last post by:
My application should periodically connect to multiple network drives to see if the certain files were created. I would do this to retrieve the list of files in UNC path //server1/backup/: ...
1
by: 2boysnus | last post by:
I set up a network at my work last week and we have been having some problems that I have not ben able to fix. We have: 2 New computers running Windows XP 2 New Computers running Windows Vista...
6
by: =?Utf-8?B?Tmljb2xhcw==?= | last post by:
Basically I got a LAN with several computer. From Computer A I'll got my appliation which should do the following: Check if any other computer lost connection to the network. (Computer B may has...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.