Link to home
Start Free TrialLog in
Avatar of ntdragon
ntdragon

asked on

Internet Host Name

i'm writing a prog in which i assume
that a name of all the internet servers
is build like that:
http://name1.name2.name3
example:
http://www.google.com
so i would like to know it right

if not then if i have a request from the broweser how can i get the host name from it

example:
GET http://www.google.com/home_pg.gif HTTP 1.0

the host name is www.google.com

thanks
Avatar of Christoffer Swanström
Christoffer Swanström
Flag of Switzerland image

In general, you can not assume that all server names consist of only three parts. Although most of them do, there also a lot of servers with 2,4,5... parts in their name.

I didn't really understand your question, could you define it a bit better?
Avatar of proskig
proskig

I agree with tosse, e.g. some have .co.uk instead of .com
Avatar of jkr
But you can assume that the host name is enclosed between '//' and the next '/'...
Avatar of ntdragon

ASKER

i would like to know
how can i get the host name from the broweser request

when broweser requests a file the request look like:

GET http://www.goole.com/home_page.gif HTTP 1.0 header...

i need to get the host name from these request <or any other request like it>

can i do what jkr said
i mean is the host name is writen between // and / <every host name>

my goal is to write a func that will get the host name from the request
<it shouldn't depend on the host name niether on the request what i mean is it should work for every request the broweser might send>
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i"ll write my funcand try it then i"ll get back
There will undoubtedly be a RFC for this, index of those at http://www.internic.net/ds/rfc-index.htm
thanks you all
my func work great with your help