WEBVTT

00:05.190 --> 00:10.050
So guys, let us see the demonstration of Dhcp server with multiplexing.

00:10.620 --> 00:17.700
So the Dhcp server with multiplexing capability has been implemented in the file TCP server dot c.

00:18.720 --> 00:21.150
So we will compile this file.

00:28.100 --> 00:33.950
So the compilation process will create an executable called X underscore server.

00:33.980 --> 00:37.520
You just have to run this binary.

00:38.240 --> 00:45.350
So our TCP server with multiplexing has started and it has created the master socket file descriptor

00:45.350 --> 00:48.110
and is now blocked on the select system call.

00:48.830 --> 00:54.290
That is, it is now waiting for the connection initiation request from some client.

00:56.050 --> 01:00.130
And now in the second window, you can see that we have a TCP client.

01:00.160 --> 01:06.820
We have already discussed the implementation of TCP client and we need not do any changes in the TCP

01:06.820 --> 01:07.870
client program.

01:07.870 --> 01:12.050
It will continue to be exactly same as what we discussed.

01:12.070 --> 01:18.790
So I can simply run the binary of TCP client that is the executable of TCP client program.

01:18.790 --> 01:25.780
And you can see that the moment I start the TCP client program, the TCP client sends the connection

01:25.780 --> 01:28.440
initiation request to the TCP server.

01:28.450 --> 01:35.350
The server has accepted the connection request from the client and is again blocked on the select system

01:35.350 --> 01:35.920
call.

01:36.460 --> 01:43.900
And now it is either waiting for the data request from the connected client that is this client or it

01:43.900 --> 01:48.280
can also receives the connection initiation request from some new client.

01:48.610 --> 01:54.950
So let us say that the connected client sends some data to our TCP server.

01:54.970 --> 01:57.740
Let us say it sends 10 or 20.

01:57.770 --> 02:04.550
So you can see that your TCP client receives the response back from the server, right?

02:04.550 --> 02:11.120
And your client is still connected with the TCP server and it can still carry out more data exchange

02:11.120 --> 02:12.140
with the server.

02:12.530 --> 02:19.130
Now let us say at this point of time a new client comes and it sends connection initiation request to

02:19.130 --> 02:19.880
the server.

02:20.450 --> 02:23.960
So let me start a new client program in the another window.

02:29.170 --> 02:37.060
So I'm starting a new client program in another window, and you can see the moment I execute this,

02:38.170 --> 02:42.320
the new TCP client sends the connection initiation request to the server.

02:42.340 --> 02:47.650
So at this point of time, two clients are connected to our TCP server.

02:50.100 --> 02:50.700
Right.

02:50.700 --> 02:57.120
And now let's see if our TCP server can process the data request from the second client or not.

02:57.510 --> 03:03.180
So let's say the second client sends the value 20 and 30 to the TCP server.

03:03.360 --> 03:10.500
Oh, you can see that our TCP server has processed the data and sends the result back to the second

03:10.500 --> 03:11.160
client.

03:11.460 --> 03:18.220
Now let's see that whether our first client can still communicate with our TCP server or not.

03:18.240 --> 03:24.620
So let's say our client C1 that is the first client sends the data to the TCP server.

03:24.630 --> 03:33.810
Let's say it sends the value of A as nine and B as two, and it still receives the result.

03:34.560 --> 03:35.370
Right.

03:35.460 --> 03:41.520
And let's see if our second client can still communicate with the TCP server.

03:41.520 --> 03:48.150
So let us send the value of A and B as 90 and 30 and it is receiving the result.

03:48.550 --> 03:55.630
So you can see that both the clients are able to communicate with the TCP server and our TCP server

03:55.630 --> 04:03.550
is able to process the data request from the two connected clients and entertain our process those requests

04:03.550 --> 04:04.690
at the same time.

04:06.150 --> 04:06.720
Right.

04:06.720 --> 04:14.130
And while our TCP server is entertaining the connected clients, a new client can always come and join

04:14.130 --> 04:15.300
the communication.

04:17.230 --> 04:17.770
Right.

04:17.770 --> 04:25.930
So this is what TCP server with multiplexing is supposed to do and we see that our TCP server is doing

04:25.930 --> 04:28.570
its job fairly well.

04:30.090 --> 04:30.600
Right.

04:30.600 --> 04:37.770
So this is how a server should be designed, that it should be able to process the data request from

04:37.770 --> 04:45.210
multiple connected clients as well as it should be in a position to process the connection initiation

04:45.210 --> 04:47.760
request from the new client.

04:48.330 --> 04:55.050
So this was Dhcp server with multiplexing capabilities implementation details for you.

04:56.270 --> 05:00.800
So this is how TCP server with multiplexing are implemented.

05:02.530 --> 05:10.270
And also, one more thing that I would like to point out that we are learning the entire TCP or socket

05:10.270 --> 05:17.290
programming in C, and you can see that when you learn the stuff in C programming language, then you

05:17.290 --> 05:19.760
really know what exactly you are doing.

05:19.780 --> 05:24.310
You really do things at the lowest level of implementation.

05:24.340 --> 05:31.960
Had you use Java or Python in order to implement these Dhcp servers or in order to do the socket programming,

05:31.960 --> 05:40.570
you would have met the same result, but probably you will not be having the in-depth knowledge and

05:40.570 --> 05:48.040
you will not be knowing that what exactly goes behind the scenes when you implement such a complicated

05:48.040 --> 05:49.720
server logic.

05:50.320 --> 05:58.870
So this is the benefit of learning stuff in C programming language because C language is neither a very

05:58.870 --> 06:02.630
high level language nor it is a very low level language.

06:02.630 --> 06:10.250
And yet it is a very powerful language and often termed as the mother of all the languages.
