So guys, let's quickly revise the socket programming APIs that we have used in our socket programming
code so far.
So the first is the socket system call socket system call is used to create a TCP or UDP master socket
file descriptor.
It is used on server side as well as client side.
The second is the select system call.
It is used for monitoring multiple file descriptors.
It can be used either on client side as well as on server sides.
It is a blocking system call.
So select system call blocks until either new connection request arrives or new data arrives from the
existing client.
Write on any file descriptors which is being monitored and present in read set accept system call is
used on TCP server side only.
So note that except system call is specific to TCP server side.
It is not even used for UDP servers except system call is used to accept the client connection request
and complete three way handshake with the client.
Fourth is the bind system call.
Bind system call is used on TCP or UDP server side.
It is used by the server application process to inform the operating system.
That is the underlying operating system, the criteria of the packets of interest.
And fifth is the lesson system call.
It is used on TCP or UDP server side.
It is used by server application process to inform the operating system the length of the queue of incoming
connection request or data request from the clients.
Then receive from system call.
It is used on the TCP or UDP server and client side.
That is, it is used on both the sides.
It is used by the server or client process to read the data that is arrived on communication file descriptors.
This call is also a blocking system call by default.
Process block.
If data hasn't arrived on a file descriptor, then seventh is assigned to system call.
It is used to send data to the client or the server that is another machine.
This system call is used on both the server as well as client sides.
Then finally we have the close system call which is used to close the connection.
It is used by the client or by the server that is either a client and the server can choose to close
the socket that it is using to carry out communication with the other machine.
Now let us go through the observations.
That is, what are the things that we would like to observe through our study of Dhcp client server
socket programming.
So our TCP server can accept and maintain up to 31 connections request.
That is up to 31 clients.
Connection request can be accepted by our server and can be maintained.
Right.
And apart from this 31 clients connection request one being the master socket file descriptor.
Right.
So server can service one client at a time.
Right.
Whether our server is a multi plex server or it is a normal server, our server could service only one
client at a time.
However, our server can maintain 31 connections.
Right.
If multiple clients data request comes together, that is, let's say up to n, all clients will be
serviced, but one by one where n is the value specified in the system call.
With the increase in number of clients, clients can begin to experience latency as they are serviced
one by one by the server.
Thus this server design is way better than previous one.
That is the server design where the server could handle only one client at a time.
Our TCP server with multiplexing can handle multiple clients at the same time.
Right.
But still our TCP server with multiplexing has scalability limitations.
Scalability limitations will always be there no matter how you design the server to handle more number
of clients.
We need to deploy more independent server machines.
That is the reason that big MNCs like Facebook Google have data centers in which there are thousands
of server machines and those server machines.
Collectively handles millions of client requests.
So don't expect a single server machine to handle significant number of clients.
Such a server is not limited by software design, but by hardware limitations.
So the point I'm trying to make here is that if you have a large number of clients, let's say 1 million
number of clients, it doesn't matter how you design your server, you are limited by hardware.
You need more server machines to handle more number of clients.
And that is the reason that big agencies have data centers in which there are thousands of server machines
and the load of millions of clients are more or less uniformly distributed on those server machines.
Now, next, let us discuss the UDP programming, so we will wrap up the UDP programming.
Very fast because creating a UDP server machine and UDP client machine is very simple.
Since we have learned how to implement the TCP client and server, then it is very easy to implement
UDP client and server.
So if you have learnt creating a TCP server machine, UDP programming is a way much simpler than TCP
programming and that is the reason that it is giving you as a homework write your own UDP server and
client.
It is very easy if you have understood the steps of implementing TCP server and TCP client, you can
definitely implement UDP server and UDP client.
So it's a homework for you to implement UDP client server program.