Web Programming with Sockets |
Have you ever dreamed of writing your own Apache web-server or Netscape browser? Writing the full
application would
be a huge undertaking, but programming a basic web-server or web-browser is not that difficult.
It all starts with some basic socket programming in the good tradition of Stevens' classic book
"Unix Network Programming". A web-server can be written in a couple of hundred lines of code, while
a program that can fetch and store web-pages is of the same complexity. Of course doing all the
graphics for rendering and displaying those pages would be way more work.
I have written this type of programs for a couple of reasons: it's a good learning experience, these programs often come in very handy as test-tools and thirdly, because they are easy customized, you can create programs that use the standard Internet protocols, but that provide functionality outside of the scope of normal web-servers. As an example, with this code as a starting point it was easy to write a web-robot that can download a whole web-site. The software comes in two very different tastes and for each I have provided firstly a simple reader that gets html pages (or images) from a web-server and secondly a basic web-server that, provided with a directory tree with content, can answer and fullfill requests from web-browsers. The two "tastes" are Java code plus classes, which will run on any platform with a Java Virtual Machine and on the other hand two Microsoft Visual C 6.0 projects and .exe's that will run on the various Win platforms. |