So guys, next let us discuss socket message types.
That is in socket based communication.
The messages that are exchanged between the client and the server processes can be broadly classified
into two types.
The first type of messages are called connection, initiation request message.
This message is used only by the client process, and this type of message is used by the client process
to request the server process to establish a dedicated connection.
So connection initiation request message is actually a request message that is generated by the client
process and this message is sent by the client process to the server process, requesting the server
process to accept and establish a dedicated connection with the client.
Only after the connection between the client and the server process has been established, then only
the client can send the second type of message, which is called service request message to the server.
So you can see in this diagram we have a client process as well as the server process and it is the
client process which wants to connect with the server process.
So the very first thing that a client process needs to do is to send a connection, initiation request
message to the server process.
So CR stands for connection initiation request message.
So connection initiation request message is actually a request to the server to accept and establish
a dedicated connection with the client.
So once the server accepts the connection initiation request from the client, the connection between
the client and the server process is set to be established and complete.
Right.
So remember, connection initiation request messages are always generated by the client process and
it is always targeted to the server process to which the client wants to carry out communication.
The second type of message is actually called service request messages.
These messages are generated by the client process and these are sent by the client process to the server
once the connection is fully established.
So remember, service request messages can only be sent by the client process only when the connection
between the client process and the server process has been fully established.
Right.
So through these messages, that is service request messages, client requests, the server to provide
a service.
So here service is nothing but a functionality that is provided by the server process to the client.
So you can see that in the step three.
Once the connection is fully established between the client process and the server process in step three,
the client process can now send service request message to the server process.
Having received the service request message, the server can process the service request message and
it can prepare some response.
Once the server prepares the response, it sends the response message back to the client.
So note that service request message is any data which is generated by the client process and is sent
by the client to the server process for processing.
So let us take a very simplest example.
Suppose a client process generates two numbers.
That is A and B.
So both these numbers constitutes a service request message.
Right and a client process.
Let us assume that our client process cannot compute the multiplication of two numbers and it relies
on the server process to actually multiply the two numbers and send back the result.
So in this example, the multiplication service that is provided by the server process is actually a
service that is provided to the client.
So in this example, the service request message will actually be the pair of two integers which is
generated by the client process and send to the server.
Once the server receives this SRM, which is actually a set of two integers, the server process would
perform the local computation on this message and it will compute the multiplication of two numbers.
Once the server process performs the multiplication of two numbers and get the result.
A server process can send back the response back to the client.
So service request message is nothing, but it is any data which is generated by the client and need
to be processed by the server process.
The result of processing the SRM message is a response which is generated by the server process and
directed to the client.
So server identifies and process both the type of messages.
Which type of messages, the connection, initiation, request message and service request message very
differently.
So you will understand this point when we will be actually discussing the code for implementing a socket
based communication on the server side as well as on the client side.
So the takeaway from this slide is that that the connection initiation request message is a message
which is used to establish a connection with the server and service request message is any data which
is sent by the client process to the server for processing and of course service request messages are
sent only once.
The connection between the client and server process has been fully established.