By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,119 Members | 2,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,119 IT Pros & Developers. It's quick & easy.

Obtaining hostname from IP Address

P: n/a
Hi,
I have an application where I monitor the status of a machine using it's IP
address. I would like to log an error when the machine goes down - but I want
to add the name of the machine along with the IP address in the log. Any
ideas how to achieve this? I have seen several examples of obtaining the IP
address given the host name using the dns.gethostbyname function but have not
seen anything that will work the other way.

Thanks in advance.

Ajay Mirmira
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 2005-02-09, amirmira <am******@discussions.microsoft.com> wrote:
Hi,
I have an application where I monitor the status of a machine using it's IP
address. I would like to log an error when the machine goes down - but I want
to add the name of the machine along with the IP address in the log. Any
ideas how to achieve this? I have seen several examples of obtaining the IP
address given the host name using the dns.gethostbyname function but have not
seen anything that will work the other way.

Thanks in advance.

Ajay Mirmira


Dns.GetHostName() will get the name of the local machine.
--
Tom Shelton [MVP]
Nov 21 '05 #2

P: n/a
Tom,
I do not want the name of the local machine. I want the name of the remote
machine whose IP address I know. I used the function:

Dns.GetHostByAddress("207.46.156.220").HostName

to get the host name. It works fine with machines on the internet(returns
"origin2.microsoft.com"), but for machines on the intranet, it does not
always work. It prefixes funny characters before the machine name. At first I
was under the impression that the DNS entries are somehow messed up - but I
double verified with the system admin (and also verified for myself) that
this is not the case.

Any ideas?

Thanks.

Ajay Mirmira

"Tom Shelton" wrote:
On 2005-02-09, amirmira <am******@discussions.microsoft.com> wrote:
Hi,
I have an application where I monitor the status of a machine using it's IP
address. I would like to log an error when the machine goes down - but I want
to add the name of the machine along with the IP address in the log. Any
ideas how to achieve this? I have seen several examples of obtaining the IP
address given the host name using the dns.gethostbyname function but have not
seen anything that will work the other way.

Thanks in advance.

Ajay Mirmira


Dns.GetHostName() will get the name of the local machine.
--
Tom Shelton [MVP]

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.