Writing Our Own Webserver Cont.
July 28, 2011 Leave a comment
After much effort and debugging the UNIX (POSIX) version of the webserver is finally bug free enough to consistently send data across. As it is configured now you can only access the server if you are on the same network as it. This is to help against intruders accessing your file system. This will soon change so that anyone can access the server as long as they have the IP address but they will be restricted to a user defined root directory, from which they will not be able to escape (mwhahaha). After testing the first build of the webserver it was noticed that some of the files had large chunks missing from them.
The standard way to send data over an estabished socket connection is through the send() function
ssize_t send(int sockfd, const void *buf, size_t len, int flags);
When the server was first constructed I assumed that this function would send all the data you tell it to, however it does not. After much research it was figured out how to force the code to send all the data. The third version of the protocol finally worked and we are now able to send the required data flawlessly. The program currently uses the unix only fork() function and will eventually need to be rewritten for the windows build. Until then more plugins will be develped