Implemeting a basic Web Server
What is a web server? Web server is a networking server that sits on a physical server waiting for client requests. The Web server creates a listening socket and starts accepting new connections in a loop. The client initiates a TCP connection and, after successfully establishing it, the client sends an HTTP request to the server and the server responds with an HTTP response that gets displayed to the user. To establish a TCP connection both clients and servers use sockets . Sockets A good understanding of sockets can be gained from reference [1] link. Simply, client sockets can be used to send and receive data, where as server sockets are used to create a client socket. In this case, the socket is bound to port 8888, and host=“ ” specifies that the socket is reachable by any address the machine happens to have. Since low numbers are reserved for well knows ports (like 80 for HTTP), I used a high number (8888). The socket ...