-
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?
-
www.xitami.com
its quite small aparantly
-
web/chat/ftp servers are actually not that hard to program. Java and sockets are your friend ;)
-
Python's even friendlier....
-
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
-
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.
-
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.
-
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).
-
-
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?
-
Wow, you really wanna go all out with this thing huh?
-
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?
-
Stovellp was responsible for the Swebs [source] web server which includes CGI support so he'd be the one to ask.
-
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
-
>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.