Is there any place I can view the source of a web server created in C or C++? Thanks !
Is there any place I can view the source of a web server created in C or C++? Thanks !
Do not make direct eye contact with me.
Forgot to add this: also, a tutorial on making them? PS Thanks confuted .
Do not make direct eye contact with me.
For a tutorial, try google.
you'll need to know HTTP protocols, to know what requests you'll be getting <like GET, POST etc etc etc> could be a very fun learn experience have fun.
Try my site at http://swebs.sourceforge.net
Thats a web server I'm working on now. Its only 1900 or so lines, and most of the stuff you need to know is in the connection.hpp file. Its very simple and is fully HTTP/1.1 compliant.
Also, search google for "http made easy", its a page I used that has a lot of information about how HTTP works, and what a web server must do to be HTTP compliant.
I'm guessing you mean this? Thanks for the link / code. I'll look into both, thanks again .
Do not make direct eye contact with me.
Yep thats the one, its the greatest thing ever written on the subject IMHO. I'm sorry about the code on my site, at the moment you have to download the entire installer to view the code, so I'm going to upload all the source now seperately. Check it sometime today (the sourceforge servers are down at the moment).
In your code, stovellp, it looks like you don't wait for the new thread to finish processing the request before you delete the thread (main.cpp:387)... couldn't that be a problem if you had, say, a very large request which took a few seconds to send?
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Thanks for looking X-Squared, my understanding of threads with NT is not very solid.
To my understanding, that creates a thread and tells it to run the function ProcessRequest(), which does the request. Then when thats finished, it moves on to close the handle to the thread... doesn't it?Code:hThread = CreateThread( NULL, 0, ProcessRequest, &Argument, 0, &dwThreadId); if (hThread != NULL) { CloseHandle( hThread ); }
Actually... now that I think about it, perhaps not. Maybe your right! What should I do in regards to closing the thread then to ensure it is closed properly AFTER the request is handled? Also, there must be a way for there to be more than one instance of this thread running (because its created for every new request).
Edit: Although, I just finished sending a file to someone that was over 600k with the server (over dial up too), which took a minute or so, and arrived perfectly in tact. So I don't think theres any problems with the threads.
Last edited by nickname_changed; 08-23-2003 at 11:52 PM.
I'm not sure how threading works, actually, I just am not sure what exactly CreateThread and CloseThread do.
[edit]
According to MSDN, CloseThread( ) doesn't actually terminate the thread, and CreateThread( ) doesn't wait for the thread to finish before returning. So, it looks like what you're doing is actually fine.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Ahh excellent. I knew that before I wrote the code actually, I was just testing (read: I guess I lucked out on that one, phew). Can you see any other problems in that code XSquared? I like having someone with your skills look over a project like this for me
>> I like having someone with your skills look over a project like this for me.
LOL. I'm still in high school, and I've never taken any courses (or bought any books about) C/C++ (although I have won an Ontario-wide programming contest). If you want someone with real skills, look to Prelude or Salem.
But thanks for the compliment.
I'm heading to bed now, but I'll have a look at the rest of the code tomorrow.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
> http://swebs.soureforge.net - My web server that I'm working on.
Its sourceforge, not soureforge. Nice looking site. I'll download it later.
lol, ops, I'd never noticed that I spelled it wrong, thanks Speedy
And thanks heaps XSquared, even if your not the words greatest, your still probably better than me and thats what counts. But if Salem or Prelude want to look at it too, I'd be very grateful
Edit: Just got a new developer on the team to create a configuration app in VB. As soon as ISAPI is implemented and I sort out a few piping problems, a version 1.0 release will be ready!
Last edited by nickname_changed; 08-24-2003 at 01:03 AM.
Hey, XSquared (or anyone), could you please look at the functions:
CONNECTION::SendBinary() and CONNECTION::SendText()?
It seems that after sending a file, I cannot delete it because I get told the file is already in use I don't understand how, since I call hFile.close(), so they should close fine. Any ideas why?
EDIT:
Lurker (or anyone else), if your interested in creating web servers, your welcome to join the SWEBS project. It would be nice to have more C++ programmers around, and it would be a nice learning experience for you. If you are then PM me for further information.
Last edited by nickname_changed; 08-25-2003 at 06:15 AM.