Click to See Complete Forum and Search --> : HTML , tcp-ip + C/C++


Mark Hodgkinson
September 13th, 1999, 03:16 PM
Basically, I want to provide the ability to do the following :-
Let a user to the internet fill in details on a web form.
That fires off a script/exe to establish a tcp-ip connection
with my server, which has a presence on the web.
By listening on a predefined socket number, an exe starts on my
server which performs an online search.
An html file is created at the server and passed back to the user
, who then sees it displayed in their browser.
Am i asking too much, and of not, how do I go about doing the
tcp-ip stuff + passing back of the html page.ANY help greatly received.

Chris Hafey
September 13th, 1999, 03:26 PM
No your not asking too much, sounds like your system will work. What in particular do you need help with? You will need a CGI on the web server to communicate with your server. There are many good web references about how to write CGI scripts. You will need to communicate between the CGI and your server using TCP/IP. Again, there are several web pages and books that can teach you these subjects.

Chris Hafey

Rares
September 15th, 1999, 07:22 AM
Basic steps:
your html form may use POST or GET as a method (eg <form .... method=GET>)
if you use GET then the cgi script/exe will receive the user input in an environment variable named QUERY_STRING. This can't be more of 2K in size.
If you use POST the cgi will receive the input via standard input (stdio in C). This has unlimited size (see the CONTENT_LENGTH env. variable to find out how much you have to read from stdin).

then you pass the response via standard output (a simple printf will do for start).
Do not forget to begin with the HTTP headers describing your response. For example:

Content-type: text/html


<html>
....
</html>



Notice the two (2) "\n"'s after the "Content-type....".

Hope this get's you o a start,
rares


... But I thought YOU did the backups...

Ashran
September 15th, 1999, 07:33 AM
Yesterday I just finished a similiar project.
Its just a demo to show that it works. I used the HTTPSVR source as a base to work with. The search itself I did with chttpconnection etc.

If you need more specific informations, write a small email to ashran@mcb.at.