Re: how to get remote host name
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 06 Feb 2007 08:01:48 -0500
No.
If it returns a failure, it means the IP address you provided has no associated host name
in the DNS database, so this means there is effectively no possibility of figuring out
that name because it doesn't exist in any accessible way.
Of course, if the remote connection gave you the ability to query its name via the
connection, that would be a different question.
The presence of various masking protocols, NAT (Network Address Translation) boxes...those
things that let all of your machines use your single Internet connection, for
example...and many related issues, including the fact that many ISPs (such as Verizon
DSL) actually do a second level of NAT trranslation when non-static IP addresses are used
(and some change the IP address daily, such as Verizon DSL), mean that the IP address you
get may have absolutely no string representation. You have to learn to live with that,
and expect it.
joe
On 6 Feb 2007 00:05:47 -0800, "Nagyjano" <nagyjano@xxxxxxxxx> wrote:
Hello!Joseph M. Newcomer [MVP]
I have a problem with getting the hostname of the other part of the
connection.
I had used gethostbyaddr() to retreive the hostname of the other side.
(When I am the server.)
If the server and the client in the same subnetwork everything work
just fine.
But as the client come from an other subnetwork this function fails
and get back a HOSTENT* structure with NULL value and with and error:
this host exists but no associated name.
My question is about how to obtain in this case the hostname of the
client?
There is a general way? Some function?
Thanks in advance.
Best Regards,
Nagyjano
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: how to get remote host name
- From: Nagyjano
- Re: how to get remote host name
- References:
- how to get remote host name
- From: Nagyjano
- how to get remote host name
- Prev by Date: Re: Here is BitBlt() drawing?
- Next by Date: Re: difficult parent window problem in CDialog::Create / ::AfxGetMainWnd
- Previous by thread: how to get remote host name
- Next by thread: Re: how to get remote host name
- Index(es):
Relevant Pages
|
Loading