TCp Server respond

I have a Component, called TTCPServer, and would simply like to know how I answer a question from a WebBrowser, that connects to my TTCpServer Application at a given port. It (The WebBrowser) peeks, GET /index.html /HTTP 1.0, or something like that, and I would like to know how I respond to this and redirect or refer it to a file on my harddrive, called index.html, so it loads it. By the way this only seems to work in Netscape, (not that it really matters).

Check this out


procedure TForm1.OnData(Socket: TSockets);
var
   S : String;
Begin
With TTCpServer1 Do
Begin
   S := Peek(Socket);
    // If everything works as it should, S now //contains perhaps, GET /index.html / HTTP 1.0 and I'd like to know how I respond to this and give it the address, 'C:\index.html' for instance, so it loads it


Hope someone can help me....
klasseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

klasseAuthor Commented:
Adjusted points to 250
0
scottcopusCommented:
Do you have a TELNET client program?  Or a simple TCP Client program?  If you want to find out what is returned from web servers, just telnet to one:

  C:\> TELNET www.microsoft.com 80

(You might have to enable Local Echo to see what you're typing)

And then type the following to see the web server's headers:
HEAD / HTTP/1.0
Or to get the whole page including the headers:
GET / HTTP/1.0

It would probably be best to telnet to a real .HTML file instead of just "www.microsoft.com/"  like  "www.server.com/afile.html".

Scott.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.