Pick a Free OS

Web server tutorial - Part 1

Basically for communication where there is a client-server flavor, the server process creates a socket and the client socket accesses the server through client socket techniques.


A socket is fundamentally nothing but an end point of communication. It can be of two types: Physical socket and Logical socket. In Logical socket operating system has its system calls, which creates them. Now for client-server access the socket needs three things to provide service or ask for service.

1) Service name (example: telnet)

2) Protocol (TCP-stream)

3) Port no (23)

The service uses protocol and protocol uses port number to provide service at server end and to get service at client end. Ultimately we find that the port number is mainly responsible for a client server communication. The protocols supported by Linux is shown by /etc/protocols and the services can be seen in /etc/services.

Let's take few more examples then start with Web server.

* telnet service uses TCP/IP protocol and communicate through port no. 23

* ftp service uses TCP/IP protocol and communicate through 20,21 port numbers

* www service uses http protocol and communicate through port no 80.

Web communication

Web communication deals with a browser type of client process and Web server type of server process. What actually happens when a user writes http://www.yahoo.com? Well, the browser transfers the URL to current machine's operating system with a destination address' operating system, which is responsible for extracting protocol i.e. "http" from the client socket (browsers) and then it packets data using layer software and over the packet it attaches the header http. This enables the remote machine to hand over the request to Web server of remote machine. Why so? Because there can be many a server running on the same machine so the particular services are distinguished by their protocol.

But how should we explain when telnet and ftp both are using same protocol but have different server Processes? The answer is that they are distinguished by their port numbers. Services may have same protocol but not the same port number. After this the operating system throws the data to network interface card through the ram and then network interface card gives it to nearest gateway, which sends the data to the server machine at server end.