Jump to content
  • Advertisement
Sign in to follow this  
Basiror

latest http protocol?

This topic is 4688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi A friend and me had the idea to write a little browsergame in C++ and we would like to write our own webserver based on the latest http protocol I have been looking on the web but the links there are around 3-4 years old What we need is access to variables posted via urls and a way to send processed data to the client e.g.: the page do you know any up to date description of the protocol?

Share this post


Link to post
Share on other sites
Advertisement
Write a custom webserver? Is anything wrong with current ones? Think that all that time you invest in writing your webserver may be used to enhance your game.

Luck!
Guimo

Share this post


Link to post
Share on other sites
Quote:
Original post by Basiror
well i don t want to work with php or any of these scripting languages

PHP is a scripting language that can be accessed through existing HTTP servers like Apache. If you're really looking to create your own HTTP server because you don't want to use PHP, I would instead suggest creating a scripting language that could be used through existing servers as PHP or Perl does. However, even these languages have had TONS of help to get them where they are today, so if you really insist on making your own script interpreter for a custom language, I wish you lots of luck, you'll need it.

Share this post


Link to post
Share on other sites
On the other hand, writing a webserver is no big deal. It can be done in a couple of hours, literally. (Of course, if you want something to match Apache, it gets a bit more complex [wink])

But I still agree, if you want to make a browser game, use PHP or ASP.net or something. It'll be easier, more robust, and probably even run faster (Yes, PHP is slower than native machine code, but it does have the advantage of running on a state-of-the-art webserver, which will probably handle heavy loads much better than anything you write.

Share this post


Link to post
Share on other sites
do you know some http libraries for c++ to implement a webserver


i dislike the use of php and asp, although we thought about a hybrid approach

using php to pass the html pages to the clients and doing the webserver <-> game server communication via sockets but as far as i know php supports only strings to be send over sockets which requires some parsing in our gameserver

i think we will move with the hybrid approach

Share this post


Link to post
Share on other sites
Quote:
Original post by joanusdmentia
I'm fairly sure that Apache (not sure about IIS) can run an executable (ie. your compiled C++ program) on a request.


Using what is commonly know as the Common Gateway Interface, or CGI for short.

You won't be able to send binary data to a web server and hope it will understand it. The HTTP protocol is purely text-driven, and the best you can do is to send him a text request with a binary attachement (the technique is used to upload files to a server). When you request some information from the server, it sends you a text header (the MIME header you may already know) and then the data. The granularity of these requests is the file level - ie you can't request anything else but files. When the browser receives the server response, it may or may not understand the text header. If it don't understand it then it will probably download the data instead of displaying it.

Thus, if you want to add some custom functions to your HTTP server, you'll also have to write the custom HTTP browser that will understand how to react to this custom functions. I believe that beginning a rewrite of both Apache and Firefox is not the good way of making an online game ;)

What you want to write is not a HTTP server, it is a custom game server.

I suggest you to take the time to think again to your game design, find your real needs, and asks here whether it can be done or not using existing technologies (there is already some great stuff out there).

PHP is rather great. It works well and is fast. I don't know ASP but I was told that ASP languages are clearer than PHP (the PHP syntax is a bit weird sometimes, and PHP code can be painfull to read). Maybe gamedev sites maintainers can give us more information about ASP. What do you dislike in both PHP and ASP (beside the fact that they are not C++, of course)?

HTH,

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!