Thread: Servers

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912

    Servers

    According to www.howstuffworks.com it is possible to write a fairly decent server program in 500 lines or maybe even a little under. Having recently given up my AV project that was actually going really well because I had no way of getting a database of virus signatures without hacking Norton or something (hey... there's an idea...) And so I thought I'd modify my efforts a bit and try to write a simple web server.

    My brother-and-law and I were playing around a bit with some Mono (new website: www.mono-project.com) bits and pieces the other day, and came across XSP, a simple server for XP. We spent a good couple of hours trying to solve problems but the code is still a little bit to bug-ridden to be of any use for a relative newbie at the subject. It's open source and not available in a stable release yet, so there goes that idea, but does anybody know of another simple but well documented example of a simple web server program?

  2. #2
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332
    www.xitami.com

    its quite small aparantly

  3. #3
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    web/chat/ftp servers are actually not that hard to program. Java and sockets are your friend

  4. #4
    junior member mix0matt's Avatar
    Join Date
    Aug 2001
    Posts
    144
    Python's even friendlier....
    THIS IS NOT JUST A CHRONICLING OF THINGS WE HAVE DONE IN THE PAST BUT OUR RISE TO POWER.

  5. #5
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332
    anyone ever tried to prorgam sockets in PHP? someone wrote a decent HTTP server in php which was pretty cool i thought. works best on unix BTW

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Python isn't available as a .NET language, and neither is PHP - and that's really what I'm looking for. Ober's suggestion helped a lot. I looked up sockets on MSDN and that seems to be exactly what I'm looking for.

    I looked up xitami and no matter how I cut it, the download never seems to work. When I try opening the zip file it just tells me it's corrupted. I did it under linux and managed to open the tar.gz file, but I was wanred that the system encountered an unexpected end of file, and the source code files were partially gibberish. Any suggestions?

    I think I'll just try and go from scratch using MSDN and sockets - thanks a lot for the help guys.
    Last edited by sean; 06-17-2004 at 07:32 AM.

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Oh and one quick socket question: for functioning in an HTTP server capacity, would you recommend asynchronous or synchronous data transfer? I'll program my server with an option for both, I think, eventually, but I'd like to get a handle on what the difference actually is.

  8. #8
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    A HTTP server should be asynchronous. The HTTP protocol relies on requests and responses, so nothing should be sent unless a request is made and a response is recieved (in other words, one way traffic).

  9. #9
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    A good, quick explaination: http://www.w3.org/Protocols/HTTP/HTTP2.html

  10. #10
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Awesome - while searching for a site I had seen a few days ago about all the different protocols supported by System.Net (.NET Framework), I stumbled across this:

    http://www.sampullara.com/http.cs

    From what I've read so far, this looks very similar to what I want to do, so it's the perfect learning example. I've got enough to go start coding, so I'll be back in a few days to find about how implement CGI and things like Flash, etc... Anybody got any suggestions up front?

  11. #11
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    Wow, you really wanna go all out with this thing huh?

  12. #12
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Well what I've discussed so far is actually turning out to be a pretty small project, so I figured why not.

    From what I've read while learning CGI and things like that, it sounded like all you really needed to do was just have Perl installed on your computer, the software for which could be downlaoded from something like the website for the Perl governing body, but it just seems a little too simple. Anyone know more?

  13. #13
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Stovellp was responsible for the Swebs [source] web server which includes CGI support so he'd be the one to ask.

  14. #14
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332
    for CGI, i think you just need to have execute files with a set program (PHP for example) and pipe it's output back to the user

  15. #15
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    >or CGI, i think you just need to have execute files with a set program
    >(PHP for example) and pipe it's output back to the user
    Almost.
    You receive the output of php and you add the headers you need to make a proper HTTP response.
    Some servers allow you the option of just doing it, but for most scripts you really want to add the headers with the server.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. General question why must of the servers written in c and not c++ ?
    By umen242 in forum Networking/Device Communication
    Replies: 3
    Last Post: 06-26-2008, 04:17 AM
  2. Processor Vendors for web servers
    By Lind in forum Tech Board
    Replies: 8
    Last Post: 10-08-2007, 05:22 AM
  3. Program to fetch MX servers
    By lopes in forum Windows Programming
    Replies: 1
    Last Post: 03-24-2006, 12:36 AM
  4. About Severs and Proxy Servers
    By bookworm in forum Tech Board
    Replies: 2
    Last Post: 06-13-2003, 03:37 AM
  5. irc servers
    By Sekti in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-28-2002, 09:23 AM