Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Internet Host Name

Posted on 2000-04-19
9
Medium Priority
?
237 Views
Last Modified: 2010-04-02
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
0
Comment
Question by:ntdragon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 8

Expert Comment

by:Christoffer Swanström
ID: 2730606
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?
0
 
LVL 5

Expert Comment

by:proskig
ID: 2730641
I agree with tosse, e.g. some have .co.uk instead of .com
0
 
LVL 86

Expert Comment

by:jkr
ID: 2730806
But you can assume that the host name is enclosed between '//' and the next '/'...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:ntdragon
ID: 2732309
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>
0
 
LVL 86

Accepted Solution

by:
jkr earned 160 total points
ID: 2732346
>>can i do what jkr said
>>i mean is the host name is writen
>>between // and /

There is one exceptions, i.e. http servers that require user authentication - in this case, it'd be sth. like

http://user@server.subnet.subdomain.ext/

So the approach would be:

- isolate the string between '//' and the 1st '/' (or the end of the URL, if no path is given)
- look if there's an '@' - if so, the server name starts there...
0
 
LVL 1

Author Comment

by:ntdragon
ID: 2732381
i"ll write my funcand try it then i"ll get back
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 2732456
There will undoubtedly be a RFC for this, index of those at http://www.internic.net/ds/rfc-index.htm
0
 
LVL 1

Author Comment

by:ntdragon
ID: 2740660
thanks you all
my func work great with your help
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question