So guys, now let's start with the socket programming.
So this is that section of the course where you will be writing some code.
So in this module we will going to cover what exactly socket programming is.
That is introduction.
We will going to discuss the architecture of client server based models and we will going to discuss
how client server model can be implemented in C, we will going to discuss TCP and UDP based socket
programming.
In fact, we will going to focus only on TCP based programming because UDP based programming is very,
very easy.
Once you get a hold on TCP based socket programming, you can easily do UDP based programming.
After that, we will see that.
How can we do multiplexing using select system call?
Now, first of all, we will also discuss that what exactly multiplexing is right?
And the Linux provides a special system call called Select, which allows us to do multiplexing here.
Multiplexing means the capability of the server to handle a number of clients at the same time.
Right.
Then we will discuss that, how TCP servers are designed.
What are the steps to actually design and develop a TCP server?
And we will have a project on socket programming.
So let us start with the introduction to client and server based model.
So what exactly client server based communication are?
Now let us try to understand that what exactly server machines are.
What is the definition of machine such that that machine is termed as server?
Right.
So server is any machine which receives the request.
Right?
It will receive the request from whom?
It will receive the request from client.
So server is any machine which receives the request.
It processes the request and optionally it returns back the result.
Right.
So any machine which has this property that is receiving the request, processing the request and returning
back the result.
Such a machine is called server machine, right?
And client is any machine which initiates the request.
So this is the simple definition of a machine to be called as a server machine and client machine.
Right?
Server machine never initiates the request.
It is only the client machine which always initiates the request.
We will quickly write a simple client server Hello world model and see.
So in this diagram you can see that you have a machine C Right.
And on the right hand side you have a machine.
S.
Right.
So C stands for client Machine.
So it is the client machine which always initiates the request.
The server machine.
On the other hand, after receiving the request, process the request.
Right and then reply back the result to the client machine.
Right?
So server is the machine which never initiates the communication, right?
It is the property of the server.
That server machine never initiates the communication.
They only receives the request that is generated by the client machine, process those requests and
return back the result to the client.
So by now you must have understood that what machines are classified as client machine and what machines
are classified as server machines.
Now in order to understand the socket programming, it is very important that you deeply understand
the functioning of two important system calls provided by Linux.
These system calls is select system call and accept system call.
So Linux Operating System provides two system calls to enable US right efficient network applications.
We will going to discuss that.
How these two system calls works.
We will going to spend a considerable time in order to understand the functioning of these two system
calls.
In C, it is difficult to write a socket based application without use of select and accept system calls.
Right?
So whenever you will be writing the socket programming in C, you will definitely be using select system
call or accept system call.
In fact, if you will be writing the socket programming based applications in any other languages,
you may be using the variant of select and accept system calls.
There will definitely be some APIs which will going to perform the function of select and accept system
calls from interview point of view.
Understanding these two calls is very important, right?
So in the interview they straight away ask you that describe or explain the select system.
Call and explain the accept system call.
Right?
So let us first grasp the idea of these two APIs that is select and accept system call.
Having understood these two system calls, remaining socket programming APIs would automatically fall
in place.
So guys, we will first build up some background regarding socket programming first.