WEBVTT

00:01.400 --> 00:07.520
Okay, now the program is completed, let's execute this once again and see.

00:08.040 --> 00:13.200
Right now you see packets in two packets and four packets in six packets in it.

00:13.200 --> 00:15.520
And it is continuing.

00:15.520 --> 00:19.160
While I want to close this, I use Ctrl C.

00:20.520 --> 00:23.560
Okay, here is something.

00:24.920 --> 00:28.360
I used Ctrl C and it is giving me this error.

00:28.400 --> 00:32.040
Name of the error is called keyboard interact okay.

00:34.440 --> 00:34.680
So.

00:36.720 --> 00:37.680
It is good okay.

00:37.720 --> 00:40.480
It's good for writing for programmers.

00:40.480 --> 00:42.520
But for the user it's not very good.

00:42.560 --> 00:48.600
Maybe user don't understand what is this means, but for the programmer it's good because they know

00:48.640 --> 00:50.720
what is keyboard interact okay.

00:51.800 --> 00:54.240
And also we can handle this okay.

00:54.280 --> 01:00.840
Instead of showing a lot of things here, we could print a beautiful simple text that user simple user

01:00.840 --> 01:04.350
understand Come back so we can do that by the name of.

01:04.950 --> 01:08.710
We can do that by using something called exception handling.

01:08.870 --> 01:09.830
Okay.

01:09.830 --> 01:12.110
Here I will do that okay.

01:13.630 --> 01:16.310
Here we are going to use try and accept.

01:16.830 --> 01:17.230
Okay.

01:17.590 --> 01:19.390
So let's use first try.

01:21.910 --> 01:22.950
And hit tab.

01:23.390 --> 01:23.790
Okay.

01:24.270 --> 01:26.790
Now first it will come and try this one.

01:27.110 --> 01:27.790
Okay.

01:27.790 --> 01:30.590
If it is not this part okay.

01:30.630 --> 01:32.270
The code is not belongs here.

01:32.710 --> 01:37.950
Now we can change it to something else that is called accept.

01:37.990 --> 01:38.430
Okay.

01:40.750 --> 01:42.030
Now let's try that.

01:42.030 --> 01:45.430
Except accept what?

01:45.630 --> 01:49.270
Except name of the error that we had here.

01:50.710 --> 01:51.430
Okay.

01:51.470 --> 01:52.870
Keyboard interact.

01:53.990 --> 01:54.830
That is here.

01:54.870 --> 01:55.950
Name of the error.

01:56.710 --> 02:02.350
And now, while it is into the accept part, I can print something.

02:02.350 --> 02:02.570
Thing.

02:03.090 --> 02:05.610
So let's print.

02:11.050 --> 02:12.530
Detected control C.

02:12.570 --> 02:12.970
Okay.

02:14.850 --> 02:18.290
Detected control.

02:20.650 --> 02:24.370
Or let's write this all in capital.

02:27.050 --> 02:27.850
Control c.

02:28.810 --> 02:32.690
And also quitting okay.

02:33.410 --> 02:35.130
Now I think it is completed.

02:35.170 --> 02:40.490
Now let's go back to terminal and execute this once again.

02:41.370 --> 02:41.570
Okay.

02:41.610 --> 02:43.210
It is sending all the packets.

02:43.250 --> 02:47.210
Now I use control C now beautiful.

02:47.690 --> 02:50.130
Let's say in detecting control C quitting.

02:50.850 --> 03:00.450
And instead of having a very big and complex error here now I have a very readable text here that everyone

03:00.490 --> 03:01.490
understand that.

03:01.530 --> 03:02.410
Okay.

03:03.010 --> 03:04.090
Thanks for watching.
