1 00:00:00,210 --> 00:00:06,450 So you will be seeing some circuit and motor trading in Britain so we can create a result. 2 00:00:07,380 --> 00:00:12,030 So before that we will be seeing some theory about how and what they are doing. 3 00:00:12,210 --> 00:00:14,130 So you can see if this is the kind. 4 00:00:17,820 --> 00:00:18,960 So this is a crime. 5 00:00:20,160 --> 00:00:29,630 And so the way you create a clean descriptor on the crime and the script, you listen infinitely far 6 00:00:29,640 --> 00:00:32,850 more serious and execute those messages. 7 00:00:32,890 --> 00:00:37,380 And so those are so these are really broadening on our system. 8 00:00:38,820 --> 00:00:43,470 These crimes will run under these crimes and other crimes. 9 00:00:44,400 --> 00:00:50,460 So we're going to use virtual machines without degrading the concept. 10 00:00:51,330 --> 00:00:54,090 So first, we'll be creating the server circuit. 11 00:00:55,020 --> 00:01:03,920 And that's a result that goes on running for the connections and the connection from the client. 12 00:01:04,560 --> 00:01:14,010 So this server that's connected to this crime and, and from then onwards, you can transfer the data 13 00:01:14,010 --> 00:01:17,100 from ground zero and vice versa. 14 00:01:18,210 --> 00:01:22,260 So first, the connection has been initiated. 15 00:01:22,440 --> 00:01:25,710 Then we can say a client has to send some data. 16 00:01:26,400 --> 00:01:28,680 My client has to send some data. 17 00:01:28,710 --> 00:01:36,620 The server will be in the meeting state waiting for the message to arrive from the client. 18 00:01:42,330 --> 00:01:48,900 Some during the ceremony cannot operate and cannot go to any other by tanker. 19 00:01:50,220 --> 00:01:52,080 So if there is another client. 20 00:01:55,430 --> 00:02:02,210 Once you connect to a server and at the time the client is about to send a message, it then server 21 00:02:02,210 --> 00:02:04,370 will be in the mating state. 22 00:02:04,730 --> 00:02:10,990 And if this another client wants to connect to the server and it cannot connect because they're in the 23 00:02:11,000 --> 00:02:15,020 waiting state and then use this connection. 24 00:02:15,080 --> 00:02:18,290 So that's why you don't want to lose another client action. 25 00:02:18,740 --> 00:02:20,660 That's all you'll be implementing there. 26 00:02:20,870 --> 00:02:24,470 But it's sort of this one. 27 00:02:27,640 --> 00:02:30,110 So we had the server. 28 00:02:30,130 --> 00:02:37,210 So whenever a client wants to connect to a server and what we're going to do is we initiate the connection. 29 00:02:37,530 --> 00:02:41,500 So a connection has been established and successfully. 30 00:02:41,860 --> 00:02:46,150 From then onwards, what we're going to do is we'll be creating a thread for this. 31 00:02:47,080 --> 00:02:48,550 So that's it for thread. 32 00:02:49,210 --> 00:02:55,720 So be trading a thread for this to handle this client's incoming and outgoing data. 33 00:02:56,620 --> 00:03:03,220 So we'll be creating the thread and we'll pass this kind of descriptor to this thread so this thread 34 00:03:03,220 --> 00:03:07,270 can handle all the messages for this server. 35 00:03:07,660 --> 00:03:16,420 Now the client can send the data to normally and for the server, but in shroud for our main thread 36 00:03:16,630 --> 00:03:26,590 this thread newly created thread we handle the client data so we can send a message and we'll be reading 37 00:03:26,590 --> 00:03:30,850 that message and we can also send back the message to the client. 38 00:03:32,200 --> 00:03:42,070 So the advantage is this trade can run without having the server going to the blacklisted. 39 00:03:42,790 --> 00:03:45,550 So even whenever there is another client. 40 00:03:48,680 --> 00:03:48,980 Lunch. 41 00:03:49,460 --> 00:03:52,070 Those are really not made for any message. 42 00:03:52,070 --> 00:03:53,270 And it goes on. 43 00:03:53,270 --> 00:03:58,880 Browning, the Bettencourt So we can go on living for another client connections. 44 00:03:59,060 --> 00:04:03,110 And whenever there is another client wants to connect with us, they can connect. 45 00:04:03,680 --> 00:04:10,340 And after connection got initiated establishing a discussion with you, creating an appropriate for 46 00:04:10,340 --> 00:04:10,670 this. 47 00:04:11,420 --> 00:04:11,870 Okay. 48 00:04:11,870 --> 00:04:15,110 I have so long to connect to me. 49 00:04:15,120 --> 00:04:25,340 So what I want to do is I want to create a thread and make sure this data transfer between this happens 50 00:04:25,340 --> 00:04:31,130 to through these trades whenever the client wants to disconnect. 51 00:04:31,370 --> 00:04:34,580 Actually, in this case, the client never wants to disconnect. 52 00:04:34,580 --> 00:04:38,960 Notice, we will choose whenever the client wants to disconnect. 53 00:04:39,050 --> 00:04:44,120 So we'll be sending a specific message like we are sleep or something like that. 54 00:04:44,480 --> 00:04:48,890 Then we will be sending the calls connection through this trade. 55 00:04:49,640 --> 00:04:57,380 After this connection course, this trader will be causing these trades automatically. 56 00:04:57,380 --> 00:04:59,200 The threads get close enough. 57 00:04:59,300 --> 00:05:01,940 They will not be good for the trade. 58 00:05:03,170 --> 00:05:12,590 So by trade base, whenever there is some connection calls between this current and this trade, in 59 00:05:12,590 --> 00:05:16,340 the same way this happens when there is any good are calls. 60 00:05:19,220 --> 00:05:26,330 So in this way, those are never girls in some working state because we be creating new trade for each 61 00:05:26,330 --> 00:05:27,110 of these clients. 62 00:05:28,460 --> 00:05:29,680 So this is about the tree? 63 00:05:29,700 --> 00:05:29,990 No. 64 00:05:29,990 --> 00:05:38,930 Let's go and see if they see the multi trading where we see a simple normal grain server with this markets. 65 00:05:43,270 --> 00:05:44,950 So I created a new format. 66 00:05:44,980 --> 00:05:46,180 Let's go and create. 67 00:05:46,180 --> 00:05:48,760 Uh, let's pretend. 68 00:05:52,500 --> 00:05:53,460 Servlet pivot. 69 00:05:53,610 --> 00:05:58,950 So we're not implementing now, we're just writing the normal code. 70 00:06:00,090 --> 00:06:04,230 Private server controller cannot be right. 71 00:06:05,160 --> 00:06:11,070 So in order for the client to connect to any server, there should be a server. 72 00:06:11,070 --> 00:06:11,640 So right. 73 00:06:12,120 --> 00:06:15,180 So we'll be using the input socket. 74 00:06:15,180 --> 00:06:18,660 So socket is combination of IP address and the port number. 75 00:06:19,440 --> 00:06:25,620 We can open a port or reason for any connections and we can do data transfer. 76 00:06:26,940 --> 00:06:33,600 We can transfer the face startup so far, but socket library is the code of this one. 77 00:06:36,370 --> 00:06:38,440 So we'll be creating the server circuit. 78 00:06:38,710 --> 00:06:48,850 So let's say server socket is request to socket, but there is a socket function inside this socket 79 00:06:48,850 --> 00:06:49,540 library. 80 00:06:50,100 --> 00:06:53,260 You need shade to create the socket descriptor. 81 00:06:53,860 --> 00:06:58,210 And first one is we need two possible arguments for this socket. 82 00:06:58,210 --> 00:07:07,960 But if I connect, so this transfer IP version for socket, so I'm going to be running on the IP Russian 83 00:07:07,960 --> 00:07:13,200 for address and partner port number so that socks three. 84 00:07:16,050 --> 00:07:22,500 So this indicates that we're recreating the socket of the tape IP version for the PCB socket. 85 00:07:22,500 --> 00:07:25,650 So this section is for streaming socket. 86 00:07:25,800 --> 00:07:30,840 So basically, we don't want to use the piece of goods here. 87 00:07:31,500 --> 00:07:38,100 So now what we're going to do is, uh, first, maybe you should bind this socket to some particular, 88 00:07:38,550 --> 00:07:39,540 uh, board number. 89 00:07:40,170 --> 00:07:42,540 So we can see that bind off. 90 00:07:43,050 --> 00:07:48,810 And here we need to pass the cable so proper IP address come up with. 91 00:07:49,380 --> 00:07:55,470 So we can initiate here IP address in sequence to start us. 92 00:07:57,680 --> 00:07:58,700 So we will be 93 00:08:01,910 --> 00:08:05,030 posting on our regular verse number one, two, three, four. 94 00:08:06,470 --> 00:08:08,780 You can see IP address and phone number. 95 00:08:10,160 --> 00:08:11,500 So I have been there. 96 00:08:11,510 --> 00:08:22,910 I was talking to these reporters and now we'll be listening for any connections that say connections. 97 00:08:24,530 --> 00:08:27,460 And we know there is a connection, like we can be a server. 98 00:08:27,620 --> 00:08:36,170 So I could not accept this, except we accept the incoming connection. 99 00:08:37,250 --> 00:08:45,320 And after the step, the connection gets established and this function returns the values. 100 00:08:45,320 --> 00:08:50,660 One is going to our socket. 101 00:08:51,260 --> 00:08:53,210 So that's going to socket and address. 102 00:08:53,900 --> 00:09:00,920 So this address, specify the address of the incoming connection and the clean socket is to handle the 103 00:09:02,330 --> 00:09:03,770 incoming and outgoing data. 104 00:09:04,970 --> 00:09:11,060 So fresh inaugurated and socket and we are by no impolite tradition port number and we went on listening 105 00:09:11,060 --> 00:09:14,690 mode and if there is any connection we'll be accepting that connection. 106 00:09:14,900 --> 00:09:20,150 And this kind of socket may be handy for the incoming and outgoing data. 107 00:09:21,920 --> 00:09:24,200 Now, what we can do is first we'll be 108 00:09:26,960 --> 00:09:29,300 receiving some message from the kind of socket. 109 00:09:29,750 --> 00:09:33,180 So to do that, we can set current as our dart off. 110 00:09:33,770 --> 00:09:34,850 So a number of weeks. 111 00:09:35,840 --> 00:09:43,750 So the kind of sending some spring of 20 right so we can say we consider the zeros can be so not only 112 00:09:43,760 --> 00:09:48,650 maybe receiving 1042048, etc. 113 00:09:51,410 --> 00:09:53,930 and we're going to print on this. 114 00:09:54,620 --> 00:09:56,870 So we need to send this to a variable. 115 00:09:57,200 --> 00:09:59,330 Let's say a message is equal to. 116 00:10:02,440 --> 00:10:07,350 Grinders are good doubles, so they'll be receiving and will be saving in that message variable. 117 00:10:07,780 --> 00:10:14,440 Now you can just simply put into the message and after that, if you want to call this target, you 118 00:10:14,440 --> 00:10:15,850 can just call this one. 119 00:10:17,560 --> 00:10:19,180 You can say soccer backwards. 120 00:10:19,540 --> 00:10:27,970 So after the closing the circle, if you don't want to, uh, you can just close that one as well. 121 00:10:29,080 --> 00:10:31,090 So this is simple server. 122 00:10:31,810 --> 00:10:39,040 When we received a message from the client and printing on our console and causing the connection. 123 00:10:41,410 --> 00:10:45,670 So let's go and build this client connection. 124 00:10:47,510 --> 00:10:48,830 So every cop in this one. 125 00:10:56,660 --> 00:11:00,330 So we're going to see the SEC. 126 00:11:02,300 --> 00:11:05,300 We can see like CBS kind of suckered. 127 00:11:05,630 --> 00:11:06,270 So she has to. 128 00:11:08,300 --> 00:11:14,570 Now, what we need to be is in order to connect to this, we can use a function called connect and it 129 00:11:14,570 --> 00:11:17,360 takes the root IP address and phone number. 130 00:11:18,200 --> 00:11:22,010 So after this, we have got connected to the server. 131 00:11:22,880 --> 00:11:30,890 So we cannot pursue the message because the server will be in the receiving mode from the client. 132 00:11:31,310 --> 00:11:38,420 So this should be coded very carefully because if you put the receiver, then the server goes on more 133 00:11:38,420 --> 00:11:40,090 and more. 134 00:11:40,550 --> 00:11:43,010 So there be some kind of the drug situation. 135 00:11:44,960 --> 00:11:46,500 But there is a flash. 136 00:11:47,150 --> 00:11:48,050 You can see that. 137 00:11:48,470 --> 00:11:51,560 So when they receive, they should be sent. 138 00:11:51,740 --> 00:11:59,390 So you can identify that the sender and if that is receiving the screen and they should be send request 139 00:11:59,450 --> 00:12:00,470 in the server. 140 00:12:01,040 --> 00:12:08,150 So let's a simple way to identify this data transfer and to prevent the drugs. 141 00:12:10,370 --> 00:12:12,290 So C is about send out. 142 00:12:12,290 --> 00:12:14,450 So let's read to describe our message. 143 00:12:15,290 --> 00:12:21,470 A hello world and see yes that send off message. 144 00:12:22,700 --> 00:12:27,770 So in Britain three, we need to encode the string so we could send only bytes. 145 00:12:28,130 --> 00:12:34,460 So this this was made commercially from Python three in by you can send the strings as well. 146 00:12:35,060 --> 00:12:40,130 So we are sending the message and after that we can just simply cause this sucker. 147 00:12:40,490 --> 00:12:42,410 So we are across this target. 148 00:12:43,370 --> 00:12:46,010 So this is simple kind of server. 149 00:12:46,640 --> 00:12:47,960 So let's go and run this one. 150 00:12:51,530 --> 00:12:58,520 So overturning those are also a good first because you told Sara there would be no connection within 151 00:12:59,090 --> 00:12:59,690 Canada. 152 00:13:01,640 --> 00:13:10,610 So now we can see there is no blinking because that means we will be in the forever running mode in 153 00:13:10,610 --> 00:13:12,320 front of their incoming actions. 154 00:13:13,850 --> 00:13:19,370 So whenever I run this one, you can see her level. 155 00:13:19,520 --> 00:13:23,240 So you can see here we can do with this one to get some. 156 00:13:27,370 --> 00:13:28,600 To get back to testing. 157 00:13:28,600 --> 00:13:36,400 So let's run this one and again see how well so mean where you can also print this address. 158 00:13:37,060 --> 00:13:37,420 Print. 159 00:13:37,840 --> 00:13:38,740 Uh, let's. 160 00:13:38,740 --> 00:13:39,070 Uh. 161 00:13:40,000 --> 00:13:40,450 But. 162 00:13:43,710 --> 00:13:46,050 Connection from the client. 163 00:13:48,270 --> 00:13:49,230 This is the address. 164 00:13:50,520 --> 00:13:52,020 Can this address? 165 00:13:54,230 --> 00:13:59,660 So I prints the IP address, not the client. 166 00:14:00,890 --> 00:14:07,580 So let's run this one and know that are on this client and I, we get the print statement and also the 167 00:14:07,580 --> 00:14:09,450 message which was signed by the client. 168 00:14:10,040 --> 00:14:16,010 And you can see here the address is the combination of, uh, I put a simple number that is also good. 169 00:14:16,700 --> 00:14:20,990 So this function here for fraud is therefore randomly chosen by the alias. 170 00:14:21,410 --> 00:14:23,240 So you can see our connection from this client. 171 00:14:24,510 --> 00:14:26,810 So you guys are our addition to the database. 172 00:14:27,380 --> 00:14:29,570 I can log this target as well. 173 00:14:31,400 --> 00:14:35,290 So now what we're going to do is we're going to build the actual server. 174 00:14:35,300 --> 00:14:42,350 So server should reason infinitely for incoming data and should send the data. 175 00:14:44,810 --> 00:14:46,790 So we can use the venue for this. 176 00:14:49,930 --> 00:14:51,220 Now that we are going to the U.S., 177 00:14:54,430 --> 00:15:02,230 we will be receiving the data in you from the client and we'll be sending the exact date back to this 178 00:15:02,230 --> 00:15:02,680 client. 179 00:15:03,310 --> 00:15:04,210 So that is called a. 180 00:15:04,870 --> 00:15:09,060 So whatever you send the same data target from the sender. 181 00:15:09,520 --> 00:15:11,040 So right through. 182 00:15:11,830 --> 00:15:16,150 So we'll be going on, uh, receiving from there. 183 00:15:16,700 --> 00:15:16,900 So. 184 00:15:17,200 --> 00:15:18,250 Client Infinitely. 185 00:15:23,930 --> 00:15:24,830 So very true. 186 00:15:25,820 --> 00:15:30,950 QUESTION So will you be receiving the one year, two four bytes and saving it to the message? 187 00:15:31,460 --> 00:15:35,750 And then we are going and printing this message for our council. 188 00:15:36,890 --> 00:15:39,020 So we need to call this one. 189 00:15:39,140 --> 00:15:42,110 So if he we will get some address. 190 00:15:51,520 --> 00:15:51,700 No. 191 00:15:51,700 --> 00:15:56,200 What we're going to do is we're sending the same letter to the client. 192 00:15:59,610 --> 00:16:00,390 Graeme disagreed. 193 00:16:00,390 --> 00:16:01,230 That's enough. 194 00:16:01,860 --> 00:16:02,610 My age. 195 00:16:02,690 --> 00:16:03,530 Hardcore. 196 00:16:11,450 --> 00:16:15,110 So I tell you first, let's cut this one and based here. 197 00:16:18,880 --> 00:16:24,670 So first of we were receiving the first two messages from the client and then we're printing on this 198 00:16:24,670 --> 00:16:27,550 and we'll be sending the same message to the client. 199 00:16:27,850 --> 00:16:29,620 And now we can just copy again. 200 00:16:29,620 --> 00:16:35,800 And at the end of this code it will be running further and we will receive the message. 201 00:16:40,860 --> 00:16:43,480 So if we can also send a message not as request. 202 00:16:44,610 --> 00:16:46,440 So we can code like that. 203 00:16:46,920 --> 00:16:50,540 So if the client sends good message to the server. 204 00:16:50,700 --> 00:16:55,200 So that means we need to cross that out of the connections. 205 00:16:57,170 --> 00:16:58,730 So they should, uh. 206 00:16:59,390 --> 00:17:00,140 They should be good. 207 00:17:00,140 --> 00:17:00,860 I think so. 208 00:17:01,310 --> 00:17:04,310 And I'm not sure this one is very effective. 209 00:17:04,430 --> 00:17:07,150 Will be sending the message higher than good. 210 00:17:07,400 --> 00:17:08,770 So enjoy this message. 211 00:17:08,900 --> 00:17:16,070 But we're going to be is we're going to see in progress tough and better message to send. 212 00:17:17,930 --> 00:17:19,070 So they should be fine. 213 00:17:22,270 --> 00:17:30,790 So we'll be asking the user to send any message, anything on the concert, and it will start in a message 214 00:17:31,150 --> 00:17:35,590 and we re sending this so we can send violent message. 215 00:17:35,590 --> 00:17:46,810 Not easy cause to create, but we're going to use we are going to send this message to the server and 216 00:17:46,810 --> 00:17:54,340 after sending we need to proceed with as you can see here first on Brazil one and so on and it should 217 00:17:54,340 --> 00:17:55,240 be one send one. 218 00:17:55,720 --> 00:17:58,030 So we should proceed from the server as well. 219 00:17:59,230 --> 00:18:03,790 So see that's also same message you can still see. 220 00:18:03,790 --> 00:18:04,060 Yes. 221 00:18:04,060 --> 00:18:08,590 But not receive off 104 bytes. 222 00:18:09,280 --> 00:18:18,490 But because so we will be receiving this message and we'll be sending this message to the console. 223 00:18:19,330 --> 00:18:22,090 And I love this one. 224 00:18:22,420 --> 00:18:28,200 We should listen again for the user input with the user did not enter the code. 225 00:18:28,750 --> 00:18:33,070 Then we want sending the message as long as the message is good. 226 00:18:33,970 --> 00:18:35,740 Okay, so let's run this one. 227 00:18:38,430 --> 00:18:41,130 So now we can see the server has been started. 228 00:18:41,310 --> 00:18:42,480 So it's good and. 229 00:18:46,650 --> 00:18:48,420 So I ordered open the same day. 230 00:18:48,600 --> 00:18:52,590 So another message to send so we can see the connection from the ground. 231 00:18:52,830 --> 00:18:54,550 So interests and I. 232 00:18:54,630 --> 00:18:56,790 And you can see the hi message. 233 00:18:58,320 --> 00:18:59,000 Hello. 234 00:18:59,470 --> 00:19:00,040 Hello. 235 00:19:00,270 --> 00:19:00,900 Well. 236 00:19:03,940 --> 00:19:10,360 Sample sockets and red square and I good whenever I could. 237 00:19:10,360 --> 00:19:16,330 And you can see the connection has been lost because we have closed the connection. 238 00:19:16,360 --> 00:19:17,530 If the message is good. 239 00:19:20,370 --> 00:19:28,290 So now what we're going to do is we're going to run this script again inside of the script, and we 240 00:19:28,290 --> 00:19:29,280 have got connection. 241 00:19:29,580 --> 00:19:36,420 Now what I'm going to do is I'm going to open another C and D and I will go and connect to this server. 242 00:19:40,700 --> 00:19:47,570 And you can see we cannot connect to this one because it is running for the discount. 243 00:19:49,280 --> 00:19:53,810 It is expecting the message from this client, but more certain from this target. 244 00:19:54,740 --> 00:19:58,490 So that's why we cannot get any messages. 245 00:19:58,700 --> 00:20:00,260 So maybe stopping this one. 246 00:20:01,370 --> 00:20:04,430 So we were writing my good trader code here. 247 00:20:07,870 --> 00:20:12,610 So let's go into trading some production, right? 248 00:20:13,220 --> 00:20:15,780 So here we turn for trading. 249 00:20:17,620 --> 00:20:24,100 So first we need to define a small function so that trades can execute this function. 250 00:20:24,610 --> 00:20:27,880 That's the function as testing. 251 00:20:31,880 --> 00:20:37,060 So this line, let's execute it. 252 00:20:38,780 --> 00:20:40,090 So this is the function? 253 00:20:40,140 --> 00:20:40,380 Yes. 254 00:20:40,410 --> 00:20:41,150 Improv function. 255 00:20:42,890 --> 00:20:44,330 Now, what I'm going to do is. 256 00:20:47,430 --> 00:20:52,010 That's easy cause to put it in that, but it does. 257 00:20:52,230 --> 00:20:53,850 So we need to create a new thread. 258 00:20:54,150 --> 00:20:56,880 So the thread function should be assigned to this thread. 259 00:21:00,180 --> 00:21:05,670 And we can set targets equal to the function without any brackets. 260 00:21:07,710 --> 00:21:11,370 Now, in order to start the street, we need to say it did not start. 261 00:21:12,960 --> 00:21:20,550 And if you go and on this one and you can see this round, this line gets executed. 262 00:21:21,090 --> 00:21:21,510 What then? 263 00:21:22,620 --> 00:21:28,510 So if you do not start this one, it never gets executed. 264 00:21:28,510 --> 00:21:28,590 It. 265 00:21:34,940 --> 00:21:38,060 My what I'm going to do is that same time. 266 00:21:42,580 --> 00:21:46,000 It's time to slip off the chair. 267 00:21:48,080 --> 00:21:48,760 2 seconds. 268 00:21:57,080 --> 00:22:01,940 So you can see the program has been set up for 2 seconds. 269 00:22:02,810 --> 00:22:06,050 So there is only one thread and one thread in this one. 270 00:22:07,400 --> 00:22:11,750 Now, what we're going to do is first I want to show you the difference. 271 00:22:12,770 --> 00:22:14,460 So that's the best thing. 272 00:22:15,260 --> 00:22:17,420 And let's say it's good this one. 273 00:22:18,830 --> 00:22:20,690 And you can see 2 seconds. 274 00:22:21,650 --> 00:22:23,100 The program has been converted. 275 00:22:23,140 --> 00:22:29,660 So let's go with this one and paste five times and let's go and run this one. 276 00:22:31,370 --> 00:22:37,100 And here you can see after 2 seconds, every function gets executed. 277 00:22:37,310 --> 00:22:41,960 So this takes like 10 seconds to complete the program. 278 00:22:43,340 --> 00:22:44,300 So we don't run that. 279 00:22:44,300 --> 00:22:46,370 We want to implement some trades. 280 00:22:47,090 --> 00:22:54,410 So what we can do is we can follow for in the range of the zero come off, right? 281 00:22:56,240 --> 00:23:00,950 Now what we can do is we can create a normal trade building. 282 00:23:00,950 --> 00:23:06,620 The trade off target is equal to our testing. 283 00:23:07,340 --> 00:23:09,470 Now I can start the trade. 284 00:23:11,870 --> 00:23:16,340 So now we be creating the trade five trades. 285 00:23:16,550 --> 00:23:21,530 Each time the trades start on its own without depending on another trade. 286 00:23:21,830 --> 00:23:26,030 Now then see, within 2 seconds, everything gets better. 287 00:23:27,950 --> 00:23:31,070 So now let's see how this got. 288 00:23:34,530 --> 00:23:36,720 Within 2 seconds are the fire trucks. 289 00:23:51,640 --> 00:23:56,830 So here we have their main program. 290 00:24:01,070 --> 00:24:06,090 So main program has been started and it is creating a new thread each time. 291 00:24:06,770 --> 00:24:07,550 So that's it. 292 00:24:07,580 --> 00:24:08,990 But even as a threat. 293 00:24:09,530 --> 00:24:09,860 Okay. 294 00:24:10,400 --> 00:24:16,730 So in the previous case, we have five testing functions and each testing function has been adequately 295 00:24:16,730 --> 00:24:20,120 completed and then only the next function has been executed. 296 00:24:20,540 --> 00:24:25,790 That's why we have five in the pool in seconds to complete the program. 297 00:24:26,750 --> 00:24:34,160 Now, what we have done is we have created a third one and it would start started immediately and get 298 00:24:34,170 --> 00:24:35,480 started immediately. 299 00:24:40,460 --> 00:24:45,260 So that even gets, uh, running back the shipping run function. 300 00:24:45,360 --> 00:24:45,740 So. 301 00:24:53,020 --> 00:25:06,250 So that thread in this loop runs this testing function and that start actually runs purple. 302 00:25:06,580 --> 00:25:14,140 And in the second loop you can see here you creating the table and it gets immediately started. 303 00:25:15,190 --> 00:25:23,770 So when the program does not stop and it goes on creating the new thread entry and it gets executed, 304 00:25:23,770 --> 00:25:24,850 it gets executed. 305 00:25:27,190 --> 00:25:30,130 Meanwhile, before and before. 306 00:25:30,940 --> 00:25:38,320 So creating threads that are big once again are baby creating money faster because it's simple for a 307 00:25:38,320 --> 00:25:42,250 loop and there is no sleep in this loop. 308 00:25:42,370 --> 00:25:50,080 So that's this fight thread that within a fraction of a second and this thread goes on waiting for seconds 309 00:25:50,260 --> 00:25:52,630 because there is a timer to multiple positions. 310 00:25:53,140 --> 00:26:00,940 So these will be 2 seconds and this will be seconds and everything will be waiting for 2 seconds and 311 00:26:00,970 --> 00:26:06,130 the baby wait concurrently. 312 00:26:06,700 --> 00:26:13,150 They won't wait for another thread to complete 2 seconds, so they be processing concurrently. 313 00:26:13,150 --> 00:26:18,850 So that's why it appears that everything gets executed right in seconds. 314 00:26:19,990 --> 00:26:25,450 So what we're going to do is we were putting the break under function, be not join. 315 00:26:25,780 --> 00:26:34,990 So if you said join, so that means this thread gets completed mentally more end the program. 316 00:26:35,260 --> 00:26:36,670 Now if you run this one. 317 00:26:38,760 --> 00:26:47,010 Now we can see the first alert has been started and the program waits for 2 seconds because the train 318 00:26:47,010 --> 00:26:48,000 has to complete. 319 00:26:48,450 --> 00:26:51,420 Otherwise, the program never ends. 320 00:26:52,410 --> 00:26:57,810 So now we can see around 10 seconds, because now is the speed of joint. 321 00:26:58,230 --> 00:27:05,980 So in this case, each thread should compared it to job before and the current. 322 00:27:07,140 --> 00:27:12,420 So if we understand this one, let's put the breakpoint here and global this out and then they work 323 00:27:12,420 --> 00:27:15,710 and run and they work this current open for. 324 00:27:17,830 --> 00:27:20,260 Now we can see it here, the starting of the front row. 325 00:27:20,680 --> 00:27:23,110 Now let's go and step into this one 326 00:27:25,780 --> 00:27:27,190 and get this one. 327 00:27:27,310 --> 00:27:30,640 And you can see here the be pretty. 328 00:27:32,740 --> 00:27:34,140 And we're on this one. 329 00:27:34,150 --> 00:27:39,670 And here you can see, uh, the trend has been started. 330 00:27:39,730 --> 00:27:46,210 And if you run this one, you can see the trade has already started, and this event gets a little bit. 331 00:27:47,740 --> 00:27:51,430 Now you've run this one, this rain, to get to the gutter. 332 00:27:52,510 --> 00:27:57,610 And upon completion of the different beta start, this function gets executed. 333 00:27:58,600 --> 00:28:03,790 So this happens very fast because you have the break point. 334 00:28:04,000 --> 00:28:09,250 That's why it appears that it takes time. 335 00:28:09,610 --> 00:28:10,430 So let's go. 336 00:28:10,480 --> 00:28:14,290 And so you can see this is the large trade. 337 00:28:14,350 --> 00:28:19,930 It is going to get started and run this one. 338 00:28:20,410 --> 00:28:22,540 Now you can see this. 339 00:28:23,260 --> 00:28:25,000 There is seconds of delay. 340 00:28:26,170 --> 00:28:27,430 So because of this point. 341 00:28:27,430 --> 00:28:27,910 That's right. 342 00:28:28,120 --> 00:28:30,210 So I hope you'll understand this moderating. 343 00:28:33,140 --> 00:28:38,540 So each thread get started on its own and start running this testing function. 344 00:28:38,720 --> 00:28:40,910 Regardless of what our trade does. 345 00:28:42,740 --> 00:28:49,640 So these are the basics of the market trading and we'll be implementing this period server here. 346 00:28:52,130 --> 00:28:56,870 So what you can do is you can also create a list and you can add these trades as well. 347 00:28:56,990 --> 00:29:00,110 So that's first set trades. 348 00:29:04,070 --> 00:29:09,320 But it's not enough to know. 349 00:29:09,320 --> 00:29:12,220 What you can believe is what we can do. 350 00:29:12,220 --> 00:29:13,220 We can also print 351 00:29:16,820 --> 00:29:18,860 the dark current. 352 00:29:24,070 --> 00:29:26,560 So we can print printouts. 353 00:29:28,390 --> 00:29:31,580 That said, this line was executed by. 354 00:29:35,940 --> 00:29:41,590 That sort of matters if we can get the trade name, as they put it, in that current period. 355 00:29:41,840 --> 00:29:42,000 But. 356 00:29:44,890 --> 00:29:45,300 No. 357 00:29:45,430 --> 00:29:51,730 So these are they're really creating for each thread so that we printer in this print statement. 358 00:29:53,530 --> 00:29:59,230 So let's go and run this one and we're going to see these events in executable thread. 359 00:29:59,230 --> 00:30:00,520 One, two, three, four, five. 360 00:30:01,030 --> 00:30:04,540 You can see this is the function them they're executing. 361 00:30:04,540 --> 00:30:11,740 And then if you consider after this print statements because these threats are kind of. 362 00:30:14,130 --> 00:30:16,780 So this is about the server and trading basics. 363 00:30:16,800 --> 00:30:19,200 So let's go and implement this one. 364 00:30:19,920 --> 00:30:20,640 So first. 365 00:30:23,740 --> 00:30:25,570 When we go back to the diagrams. 366 00:30:39,870 --> 00:30:47,250 So what we're going to do is here in the previous diagram, the client and the server. 367 00:30:47,280 --> 00:30:47,700 Right. 368 00:30:50,510 --> 00:30:59,560 So we'll be initiating the connection and after that we'll be creating a thread for this brand of the 369 00:31:00,200 --> 00:31:00,800 connection. 370 00:31:01,910 --> 00:31:07,490 So here's what we're going to do is from the main program to this thread program, we need to use some 371 00:31:07,490 --> 00:31:08,960 concept called use. 372 00:31:12,930 --> 00:31:17,820 Cuz for the uh shaping of the actual data. 373 00:31:18,030 --> 00:31:22,410 So we will be not using the pills for this will be using normal global variables. 374 00:31:22,650 --> 00:31:23,920 So we'll be creating some. 375 00:31:29,560 --> 00:31:34,480 So we'll be creating some rules so that this can be accessed by the trade functions as well. 376 00:31:34,720 --> 00:31:38,680 So it will be similar to this main, main program and this trade program. 377 00:31:39,400 --> 00:31:41,410 So we're likely going to use it. 378 00:31:41,760 --> 00:31:43,210 Let's say this is the third one. 379 00:31:43,840 --> 00:31:47,950 So the third one means we were creating some of this. 380 00:31:48,430 --> 00:31:50,520 So this is the input list. 381 00:31:51,130 --> 00:31:57,850 So the main program meeting is the data in the best position. 382 00:31:58,750 --> 00:32:00,070 So if I want. 383 00:32:00,160 --> 00:32:03,310 So the key one indicates the first element. 384 00:32:03,670 --> 00:32:07,930 So I can say I can put the ID command here. 385 00:32:10,150 --> 00:32:11,800 So from the main program. 386 00:32:11,890 --> 00:32:18,250 So we'll be creating a verbal provision for this in Britain first in the next video in that will be 387 00:32:18,250 --> 00:32:20,920 modifying this command in this way. 388 00:32:21,610 --> 00:32:30,550 So what this does is after that, in the connection, it goes on reasoning for any changes in this in 389 00:32:30,550 --> 00:32:31,780 this box. 390 00:32:32,140 --> 00:32:38,110 So that is the first element of the input list and we can name whatever we want. 391 00:32:38,470 --> 00:32:40,150 So this is the command input. 392 00:32:41,050 --> 00:32:48,170 So if there is any command in this one, it goes and sends this to this client. 393 00:32:48,190 --> 00:32:52,330 So he can go and execute this already. 394 00:32:53,080 --> 00:32:58,420 Client There will be a decoding, whatever the message it sends to us in this case. 395 00:32:58,420 --> 00:33:01,380 Idea and so upon indication of reality. 396 00:33:01,660 --> 00:33:03,880 So the output will be send this one. 397 00:33:06,810 --> 00:33:13,330 And this a big movie and praising the writer are put in this first book full of this list. 398 00:33:14,250 --> 00:33:16,170 This is their output. 399 00:33:18,120 --> 00:33:25,200 So if there is any changes for them and this will be reflected in our verbal application. 400 00:33:27,240 --> 00:33:34,170 So the verbal application we need in the input goes on to this published and this trade will be in for 401 00:33:34,890 --> 00:33:38,760 any further changes, anything that happens to this this one. 402 00:33:40,110 --> 00:33:46,770 So if there is any change, I will send this to the client and go and execute that message as they come 403 00:33:46,770 --> 00:33:48,000 in and gets their input. 404 00:33:48,390 --> 00:33:50,700 And this trade will update this in addition. 405 00:33:51,000 --> 00:33:59,580 And if the server program presents on this element and if there is any changes and it goes on reflects 406 00:33:59,610 --> 00:34:00,570 in this web server. 407 00:34:01,870 --> 00:34:05,370 So as it is, we are controlling the client. 408 00:34:05,380 --> 00:34:10,530 We are sending the input and seeing the input in the label application itself. 409 00:34:11,190 --> 00:34:13,050 So that's how we are going to do this one. 410 00:34:13,800 --> 00:34:19,680 So let's go into fittings, procedures, division and command input. 411 00:34:19,890 --> 00:34:25,140 So this is a where the the web server modifies the list. 412 00:34:25,680 --> 00:34:29,580 See, the output is equal to this one. 413 00:34:32,430 --> 00:34:35,580 So threat commander and commander. 414 00:34:36,420 --> 00:34:37,830 So these are the treaties. 415 00:34:38,610 --> 00:34:42,300 So we were creating, uh, the to this one. 416 00:34:46,180 --> 00:34:49,540 So we're treating the unit to server. 417 00:34:49,960 --> 00:34:55,800 So this will initially the actual server that's required to socket that socket. 418 00:34:55,840 --> 00:35:00,010 So you can also say if this is the server so-called. 419 00:35:05,920 --> 00:35:06,590 Soccer. 420 00:35:07,780 --> 00:35:09,190 That sucks. 421 00:35:10,570 --> 00:35:12,720 So we have created soccer. 422 00:35:13,420 --> 00:35:16,690 So let me please be binding to this one. 423 00:35:18,250 --> 00:35:22,390 Binding our VIP orders and the port number. 424 00:35:23,410 --> 00:35:27,340 So for binding, what we need to do is to reason for the connections. 425 00:35:28,240 --> 00:35:37,900 So again, yes, there is enough for connections and it's a connection comma address. 426 00:35:39,790 --> 00:35:41,720 Now we can access that. 427 00:35:42,160 --> 00:35:44,230 So we are accepting that connection. 428 00:35:45,460 --> 00:35:49,300 So from here on, what we don't use it a symbol. 429 00:35:51,130 --> 00:35:58,480 So if you see, if you use the receiver function, the server gets broken by the infinite meeting by 430 00:35:58,630 --> 00:36:01,420 waiting for a message from the client. 431 00:36:01,480 --> 00:36:04,420 So what we're going to do is we were going to create a trade for this. 432 00:36:06,940 --> 00:36:10,260 Let's import the traders we both trading. 433 00:36:10,630 --> 00:36:17,740 And if needed, building that trade off target is equal to. 434 00:36:18,730 --> 00:36:21,130 So we'll be creating another function that is called. 435 00:36:21,490 --> 00:36:23,200 And the connection. 436 00:36:26,530 --> 00:36:27,460 So that's a plus. 437 00:36:27,880 --> 00:36:30,820 So there is, uh, and the connection. 438 00:36:31,060 --> 00:36:34,750 So we'll be ending this connection and we'll be sending some arguments. 439 00:36:35,380 --> 00:36:37,450 We'll be sending these arguments connection. 440 00:36:37,450 --> 00:36:41,020 Karma does because this function should know how to handle the connection. 441 00:36:41,410 --> 00:36:43,390 So more helping handle the connection. 442 00:36:43,420 --> 00:36:44,770 We need to send this connection. 443 00:36:44,770 --> 00:36:45,220 Come out. 444 00:36:46,000 --> 00:36:47,470 It's a arxiv request. 445 00:36:47,740 --> 00:36:48,970 So we need to pass that up. 446 00:36:50,350 --> 00:36:51,760 No, I think it's. 447 00:36:52,180 --> 00:36:53,680 I don't know about this one. 448 00:36:54,460 --> 00:36:56,560 So let's say a connection address. 449 00:36:56,890 --> 00:36:59,410 Let's go and see if there are any errors. 450 00:37:04,640 --> 00:37:05,060 Okay. 451 00:37:05,150 --> 00:37:10,130 So what we're doing here is trading the trade and we need to start this trade does that. 452 00:37:10,520 --> 00:37:17,690 So before starting, what we're gonna do is we are going to do this, uh, trading for this actual trade. 453 00:37:19,550 --> 00:37:27,980 So there is a trade, me opening the trade to this, uh, this so we can access the trade index, not 454 00:37:29,030 --> 00:37:29,410 name. 455 00:37:32,090 --> 00:37:34,190 So we started this trade. 456 00:37:40,350 --> 00:37:42,530 So now we can just sit. 457 00:37:46,450 --> 00:37:47,940 Connection commanders. 458 00:37:48,100 --> 00:37:50,770 So this is how you want to handle this one. 459 00:37:54,880 --> 00:37:56,910 So this is similar sort of record. 460 00:37:56,910 --> 00:37:58,260 We have this email. 461 00:37:59,530 --> 00:38:02,800 Then in the previous review you send. 462 00:38:06,210 --> 00:38:09,570 So what we're going to be professionally we're doing the same across our. 463 00:38:15,780 --> 00:38:17,250 Message to. 464 00:38:21,030 --> 00:38:25,710 Connection to the scene of one 0 to 4 bytes that decode. 465 00:38:33,660 --> 00:38:37,800 So we were receiving the message and we're going to print this message. 466 00:38:42,260 --> 00:38:50,000 And we will be sending this message as that is what it means to that, end quote, 467 00:38:53,450 --> 00:38:55,420 where we shall be as well. 468 00:38:56,030 --> 00:38:56,430 So. 469 00:38:58,610 --> 00:39:02,450 So also see a close connection. 470 00:39:05,590 --> 00:39:06,520 Close connection. 471 00:39:06,700 --> 00:39:13,360 If you think like connection and connection, don't close. 472 00:39:16,260 --> 00:39:16,580 So. 473 00:39:17,280 --> 00:39:18,120 Mhm. 474 00:39:18,450 --> 00:39:19,770 I think they should be. 475 00:39:29,220 --> 00:39:31,320 Actually, we don't need this in the server. 476 00:39:32,400 --> 00:39:34,410 So let's put this government here. 477 00:39:35,970 --> 00:39:42,350 We can use the data we loop through. 478 00:39:43,110 --> 00:39:44,520 So creating the socket. 479 00:39:50,250 --> 00:39:54,460 We are binding to the borders and port and we're are for connections. 480 00:40:02,930 --> 00:40:10,310 Actually you don't need to create another socket as well because one socket should be enough and also 481 00:40:10,310 --> 00:40:11,510 one branch should be enough. 482 00:40:12,380 --> 00:40:17,660 If you try to bend the targets to the same problem, you get an error. 483 00:40:17,690 --> 00:40:19,310 The Pope is already most. 484 00:40:32,720 --> 00:40:35,720 So let's also take this one and add this in the main quote. 485 00:40:37,040 --> 00:40:40,130 So very true if there is in any excerpt. 486 00:40:40,400 --> 00:40:42,410 So we'll be accepting the connection. 487 00:40:43,400 --> 00:40:44,870 And we were trading the trade for. 488 00:40:50,200 --> 00:40:52,870 So we need to render available for this one also. 489 00:40:59,800 --> 00:41:01,030 While message. 490 00:41:06,370 --> 00:41:08,680 So we'll be taking your overall message. 491 00:41:09,190 --> 00:41:11,930 Not easy to convey. 492 00:41:12,400 --> 00:41:15,010 So you might say it is not easy to quit. 493 00:41:18,250 --> 00:41:20,290 Then printing that message. 494 00:41:23,190 --> 00:41:29,700 And sending that message and then converts maybe receiving another message. 495 00:41:31,020 --> 00:41:39,360 So in that sense, and this is the data and if the message is good. 496 00:41:39,630 --> 00:41:45,780 So that means we need to close the connection grows underscore connection of connection. 497 00:41:45,900 --> 00:41:48,960 So this should cause that connection as well. 498 00:41:49,560 --> 00:41:51,270 So I think I did right here. 499 00:41:51,420 --> 00:41:53,490 So it's going to this. 500 00:41:56,560 --> 00:41:58,400 I mean, what is the message here? 501 00:41:58,400 --> 00:41:59,810 And will be spreading the message. 502 00:41:59,990 --> 00:42:05,720 So we will be taking the message if it's not good, printing the message and sending the same message 503 00:42:06,440 --> 00:42:07,820 and again, receiving the message. 504 00:42:08,220 --> 00:42:08,520 Okay. 505 00:42:08,730 --> 00:42:10,640 Bishop word. 506 00:42:13,600 --> 00:42:14,800 I'm writing. 507 00:42:18,480 --> 00:42:22,500 So I think you don't need to change any of these kind of connections. 508 00:42:26,870 --> 00:42:30,110 So we need between you and your decoding, the kind connection. 509 00:42:30,440 --> 00:42:31,520 I think this should be good. 510 00:42:32,060 --> 00:42:33,650 So let's go and run this, Sara. 511 00:42:37,970 --> 00:42:45,410 So right down to Clinton High and you can see the high. 512 00:42:45,580 --> 00:42:46,240 Hello. 513 00:42:48,140 --> 00:42:57,290 So let's go and connect to this this guy and President Clinton and how you can see hello world and you 514 00:42:57,290 --> 00:43:03,530 can see the two kind of applications can concurrently. 515 00:43:05,360 --> 00:43:06,800 So what of this symbol. 516 00:43:13,470 --> 00:43:18,770 So now you can see testing, testing. 517 00:43:18,870 --> 00:43:19,750 We got them again. 518 00:43:19,770 --> 00:43:28,320 So this is how we implement this multithreading in this target blender, multiple grain connections. 519 00:43:28,740 --> 00:43:32,340 So this is this about this video? 520 00:43:32,370 --> 00:43:33,540 This is all for this video. 521 00:43:33,810 --> 00:43:37,050 And actually, they're really seeing some basics. 522 00:43:37,320 --> 00:43:46,080 And in the future, in addition, linking this flask input and output to this socket program. 523 00:43:48,150 --> 00:43:50,070 So that's also border one. 524 00:43:50,610 --> 00:43:51,570 So these are good. 525 00:43:51,810 --> 00:43:54,950 So you can see the high again. 526 00:43:54,960 --> 00:43:58,380 So this connection is separate and this connection is available. 527 00:43:58,650 --> 00:44:02,910 These are very different threads and we can see the input as well. 528 00:44:09,100 --> 00:44:10,340 So that's going to be good. 529 00:44:10,360 --> 00:44:12,280 And this should good here. 530 00:44:15,560 --> 00:44:15,990 So good. 531 00:44:16,010 --> 00:44:17,960 That's all for this video.