client server communication

client server communication
kick it on

  I was wondering to know how two computers can communicate with each other then I came to know its a client and server who are responsible to setup that communication.
Well, client and server both are applications or you can say computer programs.

Server: Its an application which listens on port and serves the request.

Client:  It's also an application who sends a request to server on particular port.

  Lets take an example of web, where browser (IE, FF) are clients who sends the request to server on port 80.
On server, there are multiple applications who listens on particular port, like IIS service listens on port 80 where SQL server listens on port 1433. 
First browser should know the location of server. That's nothing but the IP address of SERVER.
Only one application can listens on port 80 it can be a IIS or Apache. Both applications can't listens on same port. That's why, if we tell the IIS to
listen on port 80 we need to tell Apache to listen on different port like 8080. So when request came to port 80, IIS will serve that request
and when request came to port 8080 Apache will serve that request.
If we are having two IP addresses assigned to the server then for IP address we can tell the IIS to listen on port 80
and for IP address we can tell Apache to listen on port 80. In this case requests coming to IP port 80 will
get served by IIS and requests coming on  port 80 will get served by Apache. This is how we can resolve the conflicts.

   Lets talk about how Client communicates with server.
  Suppose, your IE requests a page It will start establishing the communication with
During this time if you are trying to request another page of it will establish another connection with server.
In first case, client needs to open a port with server lets say 1001 is opened to communicate with server and this port is engaged.
Means communication is not established yet. As 1001 is engaged second request opens next port 1002 with server and start communicating.
Server establishes the communication with port 1001 and responds to client on port 1001, for second request it responds to client
on port 1002.
You can use netstat command from command prompt to see foreign IP address , ports and local IP address, ports.
It also tell us the state of communication whether its established or waiting for server to respond.

TCP    smartmirror:1455  CLOSE_WAIT
TCP    smartmirror:1495  ESTABLISHED
TCP    smartmirror:1497        ESTABLISHED
TCP    smartmirror:1501  ESTABLISHE
TCP    smartmirror:1502  ESTABLISH

Here smartmirror is my local IP and 1497 is my local port who established connection with foreign IP on port http (80)

When clients talks with server on port, it doesn't mean that clients needs to have port 80 open at his end.
Clients open the available port 1455 at his end and send requests to server on port 80. Server sends a response to client on
client side port 1455.
The detailed list of available port can be see here

There exists 0 to 65535 ports out of these ports, ports ranging from 49152 to 65535 are available for
dynamic or private ports.

I hope you got clear idea of how client communicates with server.


client server monitor server MS SQL server shutdownC# send email using System.Net SMTP Create Folder On ServerServerTransfer vs Interview Questions for 2 years or 3 years delete file file on Server and codesql server default portsUnable To Connect To The Remote Clientid


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.