From: <mi...@na...> - 2010-11-18 22:08:09
|
The question didn't appear (at least the way I read it) to ask about creating a web server, but more like send data, directly, to a web browser using API. I could be wrong, and I probably am; if so, take PWM's advice. If not, please clarify. Percocet does dangerous things to the thought patterns. -mike. ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: <mi...@na...> Cc: "Jason Spalding" <jsp...@gm...>; <dev...@li...> Sent: Thursday, November 18, 2010 3:25 PM Subject: Re: [Dev-C++] (no subject) > It's quite easy to implement a trivial web server supporting http 1.0. > > Just a TCP listener, that waits for a connect. > > When it receives the connect, retrieve the received data. > > It should contain one or more text lines, followed by two newline > characters. > > If you get a "GET" request, you know a web browser wants to get a web page > from your server. The path specified after GET tells what page that is > requested - but for a really stupid server you can ignore that and always > send the same page back. > > What you then need to send back is: > --- > HTTP/1.0 200 OK\n > Server: <your_fancy_server>\n > Content-Length: <number of bytes of HTML data>\n > Connection: close\n > Content-Type: text/html; charset-iso-8859-1\n > \n > <your html page here> > --- > > Then close the connection and wait for more connects. > > The HTML part could be: > ----- > <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n > <html>\n > <head>\n > <title>My magic web page</title>\n > </head>\n > <body>\n > 12345678\n > </body> > </html> > ----- > > Or maybe replace the value 12345678 above with: > Value=12345678 > > /pwm > > On Thu, 18 Nov 2010 mi...@na... wrote: > >> Perhaps look at the MSDN documents. >> >> Or try explaining by what you mean "send an integer or string to a web >> brower" in a little more detail. >> >> -Mike. >> >> ----- Original Message ----- >> From: "Jason Spalding" <jsp...@gm...> >> To: "William Mc Coy" <wil...@ms...> >> Cc: <sty...@ya...>; <arl...@ms...>; >> <dev...@li...>; <pet...@ao...>; >> <pw...@ia...>; <gru...@co...>; <mpa...@ao...>; >> <joa...@ya...> >> Sent: Thursday, November 18, 2010 12:07 PM >> Subject: Re: [Dev-C++] (no subject) >> >> >> >I am trying to send a interger from Visual Studio 2010 using C++ to a >> > web browsers. I'd also like to send a string. Can anyone suggest a >> > resource to look at or advice? >> > >> > Jason >> > >> >> _______________________________________________ >> >> Dev-cpp-users mailing list >> >> Dev...@li... >> >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> >> >> >> >> > >> > ------------------------------------------------------------------------------ >> > Beautiful is writing same markup. Internet Explorer 9 supports >> > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. >> > Spend less time writing and rewriting code and more time creating >> > great >> > experiences on the web. Be a part of the beta today >> > http://p.sf.net/sfu/msIE9-sfdev2dev >> > _______________________________________________ >> > Dev-cpp-users mailing list >> > Dev...@li... >> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > >> >> >> ------------------------------------------------------------------------------ >> Beautiful is writing same markup. Internet Explorer 9 supports >> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. >> Spend less time writing and rewriting code and more time creating great >> experiences on the web. Be a part of the beta today >> http://p.sf.net/sfu/msIE9-sfdev2dev >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > > |