PDA

Click to See Complete Forum and Search --> : How Can I Resolve Computer Name


Jun 28th, 2000, 09:21 PM
i want resolve the IP Address to Get Host Name ,
E.G.
192.198.0.2 => Server

thank you.

Clunietp
Jun 28th, 2000, 11:54 PM
good 'ol MSDN....

http://msdn.microsoft.com/library/psdk/winsock/wsapiref_7wj6.htm

Jun 29th, 2000, 01:12 AM
can i use that with vb ?
and how ?

[Edited by S-O on 06-29-2000 at 03:20 PM]

vbsquare
Jun 30th, 2000, 04:28 PM
Hi,
A great place to look for code that you want like this is on http://www.mvps.org/vbnet

Jun 30th, 2000, 05:29 PM
That's all very well (the VBnet howto) but how do you do it in an asp script?

There's a server variable "REMOTE_HOST" but that always returns an IP for me... :(

vbsquare
Jul 1st, 2000, 06:20 AM
The following variables will return the name of the server:

HTTP_HOST
SERVER_NAME

Jul 1st, 2000, 05:16 PM
Nah...tis the hostname of the client requesting the asp page that I want... REMOTE_HOST is meant to do it but it just returns the same as REMOTE_ADDR ...is that because the server doesn't have access to a proper DNS?

vbsquare
Jul 1st, 2000, 05:57 PM
Well the majority of people accessing pages won't have a host name, simply an IP address. If you just want specific servers to access your pages then I think that REMOTE_HOST will give you what you want.

Jul 1st, 2000, 06:12 PM
Nah...doesn't seem to work... our firewall for instance (fw0.haltoncollege.ac.uk) has a static IP and very deffinately has a proper hostname...but everytime that server visits a page I just see it's IP address...I only recognise it because I remember its IP...I see it that often. :)
That's not the only example... my site keeps a log of all visits to the start page and none off the IPs are resolved when the page is supposed to display REMOTE_HOST. :(

vbsquare
Jul 2nd, 2000, 06:00 AM
Well using HTTP_REFERER gives a host name. What about HTTP_HOST? I'm guessing here. Here is the script that I use to get all the header variables:

<%
For Each Item In Request.ServerVariables
Response.Write Item & " - " & Request.ServerVariables(Item) & "<BR>"
Next
%>

parksie
Jul 2nd, 2000, 10:32 AM
matthewralston - your server log won't display the host name because if it did, every time someone visited your page, the server would have to do a reverse DNS lookup, which takes time. Apache does have this option, but it is off by default.

Clunietp
Jul 2nd, 2000, 12:12 PM
per the advice of VBSQUARE, I checked out the VBNET site:

http://www.mvps.org/vbnet/code/network/hostnamefromip.htm