Samin 486-palvelin

Etusivu | Tietoa palvelimesta | Palvelimen ohjelmisto

Flow chart:

           -----------------------
         ->| Main thread:        |
        /  | Wait for connection |
        |  -----------------------
        |             |
        |             v
        |  --------------------------
        |  | Someone connects,      |
        |  | accept the connection  |
        |   --------------------------
        |             |
        |             v
        |  --------------------------       -----------------------------
        \__| Make a clone to handle |------>| Clone: Read client's      |
           | the new connection     |       | request from the socket,  |
           --------------------------       | parse the request         |
                                            -----------------------------
                                                        |
                                                        v
                                            ---------------------     -------------------
                                            | Sanitize the path |---->| Try to find the |
                                            ---------------------     | requested file  |
                                                                      -------------------
                                          ------------------------           |
                                          | Write the file       |<----------/
                                          | contents to the      |
                                          | socket, then die     |
                                          ------------------------
  
Source code