So guys, next we will going to understand the Linux except system call.
So except system call plays a very vital role in socket programming.
It is the accept system call which establishes the duplex or bidirectional communication between the
client and the server processes which wants to communicate.
So you can see in this diagram we have a server and we have already discussed that when a server boots
up, that is when the server starts.
The first thing the server process needs to do is to create a master socket file descriptor because
it is the master socket file descriptor using which the server will accept the connection.
Because the purpose of master socket file descriptor is only to establish the connection with the new
clients.
Right.
So we assume that the server has booted up and it has created the master socket file descriptor already.
Now when the server receives a new connection initiation request message from the new client, this
connection initiation request message goes on a master socket maintained by the server that is master
socket file descriptor.
And whenever any message arrives on any socket, in this case the master socket file descriptor, that
particular master socket file descriptor is activated.
So you can see that the client C one sends the connection initiation request to the server.
This connection initiation request always arrives at the master socket file descriptor of the server.
This is done by the operating system itself.
The underlying operating system always redirects the connection initiation request messages to the master
socket file descriptor of the server.
Right.
So in the next step, when the server receives connection, initiation requests from the new client
server invokes the accept system call to establish the bi directional communication.
So in the next step, the server has invoked the accept system call.
So remember, whenever the server receives the connection initiation request on a master socket file
descriptor, the next step is always to invoke the accept system call.
And as a result of invoking the accept system call the server creates a client handle or communication
file descriptor.
So the return value of accept system call is a client handle which we also call as communication file
descriptor.
Right.
So remember, it is always an integer value.
It could be six, it could be seven, eight or anything else.
So when we will be discussing the code, we will see that file descriptors, whether it is communication
file descriptor or master socket file descriptors are always integer values.
Now, once the communication file descriptor for client C1 is created, the server will use this handle
to carry out actual data exchange with the client.
C1.
Right.
The server will use this handle to send the data as well as to receive the data from the client.
C1.
So you can see here that the client handles are used for actual communication with the client.
Right.
Also accept system call is used only for connection oriented communication.
It is not used for connectionless communication.
So there are two types of communication between the client and the server.
The first type of communication is called connection oriented communication, and the second type of
communication is called Connectionless communication.
We shall discuss in detail that what are the properties of connection oriented communication and connectionless
communication in the next slide.
But remember, except system call is used only when the type of communication between the client and
the server is connection oriented communication.
Right.
So likewise, going forward, suppose a client C two, which is now a new client, also sends the connection
initiation request to the server.
The master socket will be activated and the accept system call will be invoked.
And as a result, a new client handle will be created which will be used by the server for carrying
out data exchange with the client.
C two.
So you can see here that except system call is used to create client handles.