Click here to Skip to main content
15,072,209 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all.

I'm writing a program to do a listing of all the computers on a network. I managed to get the IP's but now I need to resolve the host name. My code works to resolve Windows PC's and server's host names but it does not work to resolve non Windows machines.

Here is my code:
Dim host As System.Net.IPHostEntry
host = System.Net.Dns.GetHostByAddress("IP address")

Thanx in advance
Sandeep Mewara 13-Oct-10 7:36am
Any error?

You can use Dns.GetHostEntry to retrieve this information. It works both ways, meaning you can give an IP and get the hostname or supply the hostname to get the IP. Have a look at the link below.[^]

Good luck!
Dalek Dave 14-Oct-10 3:34am
Good Call
I have tried using Dns.GetHostEntrybut but I get the same problem.

I use Try-Catch and get this message: "The requested name is valid, but no data of the requested type was found"
Simon_Whale 13-Oct-10 10:56am
again how doesn't it work? any error messages?
I'm sorry but I don't know what you mean :(
Like I said I use the Try-Catch and on error show the error. The msgbox only display this: "The requested name is valid, but no data of the requested type was found"

According to me it sees that the host is on the network but it can't get the host name. This is only the case with Linux machines.
E.F. Nijboer 14-Oct-10 4:13am
You should add comments instead of answers as comments because I don't get notified. I just looked because Dalek Dave voted nicely on my answer.
You can use Samba on your Linux machine to do that. Look at this link for more info:
wikus70 14-Oct-10 4:49am
Sorry about that. I'm still kind of new to this site and asking questions.
We are running Samba on one of our Linux Servers but I didn't notice that it returned the Host name. I just thought since the one Linux Server doesn't work that non of them will work.
I think installing Samba on all the Linux servers will work.
Thank you very much

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900