473,394 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to retriever network computer's Host Name and Mac Address?

Simple network scanner is a part of my dotnet solution. It pings ip
addresses in a selected network range and gives me the response time for
each computer it finds.

Anyhow, I would need to retrieve two more pieces of information for each
active (local network) IP address:

- Computer's Host Name
- Mac Address

Can someone give me an example of how to do so?
I've have this working in Delphi, but I need to port this functionality
into my dotnet version of the program.

Thank you for your time, your help is really appreciated.

Martin
Nov 16 '07 #1
2 4736
Martin,

You might be able to get the host name through the static GetHostEntry
method on the Dns class, but I don't know that it will give you the NETBIOS
name (which is what I think you are after).

As for getting the mac address, you will have to connect to the WMI
provider on the host machine and then query for the Win32_NetworkAdapter
instance that corresponds to the IP address (which you will have to join in
the WMI query with the appropriate Win32_NetworkAdapterConfiguration
instance) to get the mac address.

How were you doing it in Delphi? If you were using Windows APIs, then
you might find it easier to just translate the calls into .NET.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"martin lanny" <tr********@gmail.comwrote in message
news:cd******************************@giganews.com ...
Simple network scanner is a part of my dotnet solution. It pings ip
addresses in a selected network range and gives me the response time for
each computer it finds.

Anyhow, I would need to retrieve two more pieces of information for each
active (local network) IP address:

- Computer's Host Name
- Mac Address

Can someone give me an example of how to do so?
I've have this working in Delphi, but I need to port this functionality
into my dotnet version of the program.

Thank you for your time, your help is really appreciated.

Martin
Nov 16 '07 #2
Hi Martin,

visit my Page, scroll down on the right side until you
find the "NetworkInformationNET" Project. It is
exactly what you are looking for, open source and
with full source code included. Its written in C++.NET
but you will easily translate it to C#....

Sign my guestbook ( i need some entries, its new :-)...)

http://entwicklung.junetz.de/

Cheers

Kerem

---------
New Open Source Tools from me:
Calculate MD5 or SHA1 Hash for Files!
KHash Tools 1.0 Englisch:
http://download.chip.eu/de/KHash-Tools-1.0_1317168.html
http://entwicklung.junetz.de/project...ls%20v.1.0.zip
---------

Beste Grüsse / Best regards / Votre bien devoue

Kerem Gümrükcü
ke*****@arcor.de

Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2

Latest Open-Source Projects: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/

-----------------------
"This reply is provided as is, without warranty express or implied."
Nov 16 '07 #3

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

Similar topics

0
by: Alphamacaroon | last post by:
All, I'm wondering if anyone can help me with a strange problem I'm having. First off, here's what I'm trying to do: I'm developing a UDP network application that should allow the end user to...
1
by: Uzi Baruch | last post by:
Hi! i want to know if i have an ip address of a computer and its DNS server name, if their is an windows API that can resolve the computer name of the given ip address. or vice verca -...
1
by: david.kao | last post by:
Hi All: Yesterday, we released our first .NET window based program on company’s network. In order to make our .NET program run correctly from a shared network driver, we also installed a...
0
by: Eddy_w | last post by:
Hello, I try to ping from my mobile device with a wireless connection to my pc. I found the class clsping on the internet and it works perfect with application from pc to pc but when i use it...
12
by: dennist685 | last post by:
How to get an Access database on the web from my own computer I have an Access database project in inetpub/wwwroot/Access2 . I build it, and then press cntrl-F5. - I still get the development...
0
by: Kyle Freeman | last post by:
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...
1
by: kartik369 | last post by:
This code gets the IP address from the computer name we already know. I wanted to know how can we get the computer name if we know the IP address. Thanks void AsyncServer::InitSocks() {...
2
by: martin lanny | last post by:
Simple network scanner is a part of my dotnet solution. It pings ip addresses in a selected network range and gives me the response time for each computer it finds. Anyhow, I would need to...
6
by: Tony | last post by:
Hello! This is the scenarion that we want to implement. We have a computer called A which register itself on a superviser server about it's existence so other computer can get the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.