5,316,870 members and growing! (15,772 online)
Email Password   helpLost your password?
Languages » C# » Windows Forms     Intermediate License: The Code Project Open License (CPOL)

Simple Network Scanner

By mamirbalouch

Scans given workgroup for computer names, with IP and MAC address
C# (C# 1.0, C# 2.0, C# 3.0, C#), .NET (.NET, .NET 2.0), Visual Studio (VS2005, Visual Studio), Dev

Posted: 24 Apr 2008
Updated: 24 Apr 2008
Views: 2,010
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
5 votes for this Article.
Popularity: 2.20 Rating: 3.14 out of 5
0 votes, 0.0%
1
1 vote, 20.0%
2
2 votes, 40.0%
3
1 vote, 20.0%
4
1 vote, 20.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article


Introduction

This simple network scanner scans the given work group/domain for computers in Directory Services. It also displays their IP and MAC addresses. You will also find code to get IP address against computer name and to get MAC address against IP address.

Background

It all started when I was developing a Backup System, which was supposed to list all the computers in a network and later user can select any one or all computers and can record backup.

Using the code

This is a very easy to use application. Just download this application and type your work group or domain name and press Scan button.

In first step, this system will get all directory entries in Directory Services (to user directory services in your project, you must add a reference to System.DirectoryServices namespace) using following code:

DirectoryEntry DomainEntry = new 
    DirectoryEntry("WinNT://" + txtWorkGroupName.Text + ""); 
DomainEntry.Children.SchemaFilter.Add("Computer");

         

Next it will iterate for all computers/machines through DomainEntry; and it will call getIPByName() function to get the IP address. getIPByName() function uses System.Net.DNS static class to get IP address.

In the last there is a function getMACAddress(IPAddress ipAddress), in this function SendARP() function call has been made to get MAC address against IP. SendARP() is part of iphlpapi.dll.

Points of Interest

You can get a list of computers in your network with their IP and MAC addresses, which means it is a three in one package.

License

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

About the Author

mamirbalouch


I have a Masters Degree in Information Technology, supported by a Bachelors Degree in Information Technology. I am working as a software developer for five years. I have a good experience in developing business applications including Accounting, Payroll, Inventory and Student Information systems. I have also developed an application name Virtual Reception. Which is a Artificial Intelligence based, interactive application.
Occupation: Software Developer (Senior)
Company: Business Intelligence Technologies 360
Location: Pakistan Pakistan

Other popular C# articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 3 of 3 (Total in Forum: 3) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralAbout The Networkmemberaimanmfk21:11 3 Jul '08  
GeneralQuestionmvpHans Dietrich1:53 24 Apr '08  
GeneralRe: Questionmembermamirbalouch23:51 24 Apr '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 24 Apr 2008
Editor: Chris Maunder
Copyright 2008 by mamirbalouch
Everything else Copyright © CodeProject, 1999-2008
Web20 | Advertise on the Code Project