WEBVTT

00:05.540 --> 00:09.800
So guys, next let us discuss socket message types.

00:09.950 --> 00:12.940
That is in socket based communication.

00:12.950 --> 00:19.610
The messages that are exchanged between the client and the server processes can be broadly classified

00:19.610 --> 00:21.200
into two types.

00:22.970 --> 00:28.580
The first type of messages are called connection, initiation request message.

00:28.970 --> 00:37.040
This message is used only by the client process, and this type of message is used by the client process

00:37.040 --> 00:42.170
to request the server process to establish a dedicated connection.

00:42.470 --> 00:49.100
So connection initiation request message is actually a request message that is generated by the client

00:49.100 --> 00:56.450
process and this message is sent by the client process to the server process, requesting the server

00:56.450 --> 01:02.660
process to accept and establish a dedicated connection with the client.

01:03.920 --> 01:10.590
Only after the connection between the client and the server process has been established, then only

01:10.590 --> 01:17.700
the client can send the second type of message, which is called service request message to the server.

01:18.000 --> 01:24.150
So you can see in this diagram we have a client process as well as the server process and it is the

01:24.150 --> 01:28.530
client process which wants to connect with the server process.

01:28.530 --> 01:35.400
So the very first thing that a client process needs to do is to send a connection, initiation request

01:35.400 --> 01:37.530
message to the server process.

01:37.740 --> 01:42.150
So CR stands for connection initiation request message.

01:43.940 --> 01:50.420
So connection initiation request message is actually a request to the server to accept and establish

01:50.420 --> 01:53.150
a dedicated connection with the client.

01:54.320 --> 02:01.250
So once the server accepts the connection initiation request from the client, the connection between

02:01.250 --> 02:06.260
the client and the server process is set to be established and complete.

02:07.300 --> 02:07.900
Right.

02:07.900 --> 02:13.720
So remember, connection initiation request messages are always generated by the client process and

02:13.720 --> 02:20.290
it is always targeted to the server process to which the client wants to carry out communication.

02:21.730 --> 02:26.230
The second type of message is actually called service request messages.

02:27.160 --> 02:34.930
These messages are generated by the client process and these are sent by the client process to the server

02:34.930 --> 02:37.510
once the connection is fully established.

02:37.780 --> 02:44.410
So remember, service request messages can only be sent by the client process only when the connection

02:44.410 --> 02:49.120
between the client process and the server process has been fully established.

02:51.130 --> 02:51.820
Right.

02:51.820 --> 02:58.270
So through these messages, that is service request messages, client requests, the server to provide

02:58.270 --> 02:59.290
a service.

02:59.320 --> 03:06.220
So here service is nothing but a functionality that is provided by the server process to the client.

03:07.360 --> 03:09.700
So you can see that in the step three.

03:09.700 --> 03:16.120
Once the connection is fully established between the client process and the server process in step three,

03:16.120 --> 03:21.790
the client process can now send service request message to the server process.

03:21.790 --> 03:28.690
Having received the service request message, the server can process the service request message and

03:28.690 --> 03:31.240
it can prepare some response.

03:32.540 --> 03:38.030
Once the server prepares the response, it sends the response message back to the client.

03:39.200 --> 03:46.220
So note that service request message is any data which is generated by the client process and is sent

03:46.220 --> 03:49.460
by the client to the server process for processing.

03:51.000 --> 03:53.940
So let us take a very simplest example.

03:53.940 --> 03:56.820
Suppose a client process generates two numbers.

03:56.820 --> 03:58.620
That is A and B.

03:59.910 --> 04:04.740
So both these numbers constitutes a service request message.

04:06.240 --> 04:08.610
Right and a client process.

04:08.610 --> 04:16.050
Let us assume that our client process cannot compute the multiplication of two numbers and it relies

04:16.050 --> 04:21.570
on the server process to actually multiply the two numbers and send back the result.

04:22.350 --> 04:29.100
So in this example, the multiplication service that is provided by the server process is actually a

04:29.100 --> 04:31.410
service that is provided to the client.

04:33.540 --> 04:40.200
So in this example, the service request message will actually be the pair of two integers which is

04:40.200 --> 04:43.440
generated by the client process and send to the server.

04:43.830 --> 04:50.520
Once the server receives this SRM, which is actually a set of two integers, the server process would

04:50.520 --> 04:56.460
perform the local computation on this message and it will compute the multiplication of two numbers.

04:58.390 --> 05:03.460
Once the server process performs the multiplication of two numbers and get the result.

05:03.490 --> 05:07.390
A server process can send back the response back to the client.

05:09.450 --> 05:16.260
So service request message is nothing, but it is any data which is generated by the client and need

05:16.260 --> 05:18.750
to be processed by the server process.

05:18.780 --> 05:26.430
The result of processing the SRM message is a response which is generated by the server process and

05:26.430 --> 05:28.170
directed to the client.

05:29.220 --> 05:33.540
So server identifies and process both the type of messages.

05:34.890 --> 05:40.860
Which type of messages, the connection, initiation, request message and service request message very

05:40.860 --> 05:41.760
differently.

05:41.970 --> 05:48.900
So you will understand this point when we will be actually discussing the code for implementing a socket

05:48.900 --> 05:53.280
based communication on the server side as well as on the client side.

05:54.690 --> 06:00.630
So the takeaway from this slide is that that the connection initiation request message is a message

06:00.630 --> 06:07.950
which is used to establish a connection with the server and service request message is any data which

06:07.950 --> 06:14.460
is sent by the client process to the server for processing and of course service request messages are

06:14.460 --> 06:15.810
sent only once.

06:15.810 --> 06:20.550
The connection between the client and server process has been fully established.
