So you will be seeing some circuit and motor trading in Britain so we can create a result.
So before that we will be seeing some theory about how and what they are doing.
So you can see if this is the kind.
So this is a crime.
And so the way you create a clean descriptor on the crime and the script, you listen infinitely far
more serious and execute those messages.
And so those are so these are really broadening on our system.
These crimes will run under these crimes and other crimes.
So we're going to use virtual machines without degrading the concept.
So first, we'll be creating the server circuit.
And that's a result that goes on running for the connections and the connection from the client.
So this server that's connected to this crime and, and from then onwards, you can transfer the data
from ground zero and vice versa.
So first, the connection has been initiated.
Then we can say a client has to send some data.
My client has to send some data.
The server will be in the meeting state waiting for the message to arrive from the client.
Some during the ceremony cannot operate and cannot go to any other by tanker.
So if there is another client.
Once you connect to a server and at the time the client is about to send a message, it then server
will be in the mating state.
And if this another client wants to connect to the server and it cannot connect because they're in the
waiting state and then use this connection.
So that's why you don't want to lose another client action.
That's all you'll be implementing there.
But it's sort of this one.
So we had the server.
So whenever a client wants to connect to a server and what we're going to do is we initiate the connection.
So a connection has been established and successfully.
From then onwards, what we're going to do is we'll be creating a thread for this.
So that's it for thread.
So be trading a thread for this to handle this client's incoming and outgoing data.
So we'll be creating the thread and we'll pass this kind of descriptor to this thread so this thread
can handle all the messages for this server.
Now the client can send the data to normally and for the server, but in shroud for our main thread
this thread newly created thread we handle the client data so we can send a message and we'll be reading
that message and we can also send back the message to the client.
So the advantage is this trade can run without having the server going to the blacklisted.
So even whenever there is another client.
Lunch.
Those are really not made for any message.
And it goes on.
Browning, the Bettencourt So we can go on living for another client connections.
And whenever there is another client wants to connect with us, they can connect.
And after connection got initiated establishing a discussion with you, creating an appropriate for
this.
Okay.
I have so long to connect to me.
So what I want to do is I want to create a thread and make sure this data transfer between this happens
to through these trades whenever the client wants to disconnect.
Actually, in this case, the client never wants to disconnect.
Notice, we will choose whenever the client wants to disconnect.
So we'll be sending a specific message like we are sleep or something like that.
Then we will be sending the calls connection through this trade.
After this connection course, this trader will be causing these trades automatically.
The threads get close enough.
They will not be good for the trade.
So by trade base, whenever there is some connection calls between this current and this trade, in
the same way this happens when there is any good are calls.
So in this way, those are never girls in some working state because we be creating new trade for each
of these clients.
So this is about the tree?
No.
Let's go and see if they see the multi trading where we see a simple normal grain server with this markets.
So I created a new format.
Let's go and create.
Uh, let's pretend.
Servlet pivot.
So we're not implementing now, we're just writing the normal code.
Private server controller cannot be right.
So in order for the client to connect to any server, there should be a server.
So right.
So we'll be using the input socket.
So socket is combination of IP address and the port number.
We can open a port or reason for any connections and we can do data transfer.
We can transfer the face startup so far, but socket library is the code of this one.
So we'll be creating the server circuit.
So let's say server socket is request to socket, but there is a socket function inside this socket
library.
You need shade to create the socket descriptor.
And first one is we need two possible arguments for this socket.
But if I connect, so this transfer IP version for socket, so I'm going to be running on the IP Russian
for address and partner port number so that socks three.
So this indicates that we're recreating the socket of the tape IP version for the PCB socket.
So this section is for streaming socket.
So basically, we don't want to use the piece of goods here.
So now what we're going to do is, uh, first, maybe you should bind this socket to some particular,
uh, board number.
So we can see that bind off.
And here we need to pass the cable so proper IP address come up with.
So we can initiate here IP address in sequence to start us.
So we will be
posting on our regular verse number one, two, three, four.
You can see IP address and phone number.
So I have been there.
I was talking to these reporters and now we'll be listening for any connections that say connections.
And we know there is a connection, like we can be a server.
So I could not accept this, except we accept the incoming connection.
And after the step, the connection gets established and this function returns the values.
One is going to our socket.
So that's going to socket and address.
So this address, specify the address of the incoming connection and the clean socket is to handle the
incoming and outgoing data.
So fresh inaugurated and socket and we are by no impolite tradition port number and we went on listening
mode and if there is any connection we'll be accepting that connection.
And this kind of socket may be handy for the incoming and outgoing data.
Now, what we can do is first we'll be
receiving some message from the kind of socket.
So to do that, we can set current as our dart off.
So a number of weeks.
So the kind of sending some spring of 20 right so we can say we consider the zeros can be so not only
maybe receiving 1042048, etc.
and we're going to print on this.
So we need to send this to a variable.
Let's say a message is equal to.
Grinders are good doubles, so they'll be receiving and will be saving in that message variable.
Now you can just simply put into the message and after that, if you want to call this target, you
can just call this one.
You can say soccer backwards.
So after the closing the circle, if you don't want to, uh, you can just close that one as well.
So this is simple server.
When we received a message from the client and printing on our console and causing the connection.
So let's go and build this client connection.
So every cop in this one.
So we're going to see the SEC.
We can see like CBS kind of suckered.
So she has to.
Now, what we need to be is in order to connect to this, we can use a function called connect and it
takes the root IP address and phone number.
So after this, we have got connected to the server.
So we cannot pursue the message because the server will be in the receiving mode from the client.
So this should be coded very carefully because if you put the receiver, then the server goes on more
and more.
So there be some kind of the drug situation.
But there is a flash.
You can see that.
So when they receive, they should be sent.
So you can identify that the sender and if that is receiving the screen and they should be send request
in the server.
So let's a simple way to identify this data transfer and to prevent the drugs.
So C is about send out.
So let's read to describe our message.
A hello world and see yes that send off message.
So in Britain three, we need to encode the string so we could send only bytes.
So this this was made commercially from Python three in by you can send the strings as well.
So we are sending the message and after that we can just simply cause this sucker.
So we are across this target.
So this is simple kind of server.
So let's go and run this one.
So overturning those are also a good first because you told Sara there would be no connection within
Canada.
So now we can see there is no blinking because that means we will be in the forever running mode in
front of their incoming actions.
So whenever I run this one, you can see her level.
So you can see here we can do with this one to get some.
To get back to testing.
So let's run this one and again see how well so mean where you can also print this address.
Print.
Uh, let's.
Uh.
But.
Connection from the client.
This is the address.
Can this address?
So I prints the IP address, not the client.
So let's run this one and know that are on this client and I, we get the print statement and also the
message which was signed by the client.
And you can see here the address is the combination of, uh, I put a simple number that is also good.
So this function here for fraud is therefore randomly chosen by the alias.
So you can see our connection from this client.
So you guys are our addition to the database.
I can log this target as well.
So now what we're going to do is we're going to build the actual server.
So server should reason infinitely for incoming data and should send the data.
So we can use the venue for this.
Now that we are going to the U.S.,
we will be receiving the data in you from the client and we'll be sending the exact date back to this
client.
So that is called a.
So whatever you send the same data target from the sender.
So right through.
So we'll be going on, uh, receiving from there.
So.
Client Infinitely.
So very true.
QUESTION So will you be receiving the one year, two four bytes and saving it to the message?
And then we are going and printing this message for our council.
So we need to call this one.
So if he we will get some address.
No.
What we're going to do is we're sending the same letter to the client.
Graeme disagreed.
That's enough.
My age.
Hardcore.
So I tell you first, let's cut this one and based here.
So first of we were receiving the first two messages from the client and then we're printing on this
and we'll be sending the same message to the client.
And now we can just copy again.
And at the end of this code it will be running further and we will receive the message.
So if we can also send a message not as request.
So we can code like that.
So if the client sends good message to the server.
So that means we need to cross that out of the connections.
So they should, uh.
They should be good.
I think so.
And I'm not sure this one is very effective.
Will be sending the message higher than good.
So enjoy this message.
But we're going to be is we're going to see in progress tough and better message to send.
So they should be fine.
So we'll be asking the user to send any message, anything on the concert, and it will start in a message
and we re sending this so we can send violent message.
Not easy cause to create, but we're going to use we are going to send this message to the server and
after sending we need to proceed with as you can see here first on Brazil one and so on and it should
be one send one.
So we should proceed from the server as well.
So see that's also same message you can still see.
Yes.
But not receive off 104 bytes.
But because so we will be receiving this message and we'll be sending this message to the console.
And I love this one.
We should listen again for the user input with the user did not enter the code.
Then we want sending the message as long as the message is good.
Okay, so let's run this one.
So now we can see the server has been started.
So it's good and.
So I ordered open the same day.
So another message to send so we can see the connection from the ground.
So interests and I.
And you can see the hi message.
Hello.
Well.
Sample sockets and red square and I good whenever I could.
And you can see the connection has been lost because we have closed the connection.
If the message is good.
So now what we're going to do is we're going to run this script again inside of the script, and we
have got connection.
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.
And you can see we cannot connect to this one because it is running for the discount.
It is expecting the message from this client, but more certain from this target.
So that's why we cannot get any messages.
So maybe stopping this one.
So we were writing my good trader code here.
So let's go into trading some production, right?
So here we turn for trading.
So first we need to define a small function so that trades can execute this function.
That's the function as testing.
So this line, let's execute it.
So this is the function?
Yes.
Improv function.
Now, what I'm going to do is.
That's easy cause to put it in that, but it does.
So we need to create a new thread.
So the thread function should be assigned to this thread.
And we can set targets equal to the function without any brackets.
Now, in order to start the street, we need to say it did not start.
And if you go and on this one and you can see this round, this line gets executed.
What then?
So if you do not start this one, it never gets executed.
It.
My what I'm going to do is that same time.
It's time to slip off the chair.
2 seconds.
So you can see the program has been set up for 2 seconds.
So there is only one thread and one thread in this one.
Now, what we're going to do is first I want to show you the difference.
So that's the best thing.
And let's say it's good this one.
And you can see 2 seconds.
The program has been converted.
So let's go with this one and paste five times and let's go and run this one.
And here you can see after 2 seconds, every function gets executed.
So this takes like 10 seconds to complete the program.
So we don't run that.
We want to implement some trades.
So what we can do is we can follow for in the range of the zero come off, right?
Now what we can do is we can create a normal trade building.
The trade off target is equal to our testing.
Now I can start the trade.
So now we be creating the trade five trades.
Each time the trades start on its own without depending on another trade.
Now then see, within 2 seconds, everything gets better.
So now let's see how this got.
Within 2 seconds are the fire trucks.
So here we have their main program.
So main program has been started and it is creating a new thread each time.
So that's it.
But even as a threat.
Okay.
So in the previous case, we have five testing functions and each testing function has been adequately
completed and then only the next function has been executed.
That's why we have five in the pool in seconds to complete the program.
Now, what we have done is we have created a third one and it would start started immediately and get
started immediately.
So that even gets, uh, running back the shipping run function.
So.
So that thread in this loop runs this testing function and that start actually runs purple.
And in the second loop you can see here you creating the table and it gets immediately started.
So when the program does not stop and it goes on creating the new thread entry and it gets executed,
it gets executed.
Meanwhile, before and before.
So creating threads that are big once again are baby creating money faster because it's simple for a
loop and there is no sleep in this loop.
So that's this fight thread that within a fraction of a second and this thread goes on waiting for seconds
because there is a timer to multiple positions.
So these will be 2 seconds and this will be seconds and everything will be waiting for 2 seconds and
the baby wait concurrently.
They won't wait for another thread to complete 2 seconds, so they be processing concurrently.
So that's why it appears that everything gets executed right in seconds.
So what we're going to do is we were putting the break under function, be not join.
So if you said join, so that means this thread gets completed mentally more end the program.
Now if you run this one.
Now we can see the first alert has been started and the program waits for 2 seconds because the train
has to complete.
Otherwise, the program never ends.
So now we can see around 10 seconds, because now is the speed of joint.
So in this case, each thread should compared it to job before and the current.
So if we understand this one, let's put the breakpoint here and global this out and then they work
and run and they work this current open for.
Now we can see it here, the starting of the front row.
Now let's go and step into this one
and get this one.
And you can see here the be pretty.
And we're on this one.
And here you can see, uh, the trend has been started.
And if you run this one, you can see the trade has already started, and this event gets a little bit.
Now you've run this one, this rain, to get to the gutter.
And upon completion of the different beta start, this function gets executed.
So this happens very fast because you have the break point.
That's why it appears that it takes time.
So let's go.
And so you can see this is the large trade.
It is going to get started and run this one.
Now you can see this.
There is seconds of delay.
So because of this point.
That's right.
So I hope you'll understand this moderating.
So each thread get started on its own and start running this testing function.
Regardless of what our trade does.
So these are the basics of the market trading and we'll be implementing this period server here.
So what you can do is you can also create a list and you can add these trades as well.
So that's first set trades.
But it's not enough to know.
What you can believe is what we can do.
We can also print
the dark current.
So we can print printouts.
That said, this line was executed by.
That sort of matters if we can get the trade name, as they put it, in that current period.
But.
No.
So these are they're really creating for each thread so that we printer in this print statement.
So let's go and run this one and we're going to see these events in executable thread.
One, two, three, four, five.
You can see this is the function them they're executing.
And then if you consider after this print statements because these threats are kind of.
So this is about the server and trading basics.
So let's go and implement this one.
So first.
When we go back to the diagrams.
So what we're going to do is here in the previous diagram, the client and the server.
Right.
So we'll be initiating the connection and after that we'll be creating a thread for this brand of the
connection.
So here's what we're going to do is from the main program to this thread program, we need to use some
concept called use.
Cuz for the uh shaping of the actual data.
So we will be not using the pills for this will be using normal global variables.
So we'll be creating some.
So we'll be creating some rules so that this can be accessed by the trade functions as well.
So it will be similar to this main, main program and this trade program.
So we're likely going to use it.
Let's say this is the third one.
So the third one means we were creating some of this.
So this is the input list.
So the main program meeting is the data in the best position.
So if I want.
So the key one indicates the first element.
So I can say I can put the ID command here.
So from the main program.
So we'll be creating a verbal provision for this in Britain first in the next video in that will be
modifying this command in this way.
So what this does is after that, in the connection, it goes on reasoning for any changes in this in
this box.
So that is the first element of the input list and we can name whatever we want.
So this is the command input.
So if there is any command in this one, it goes and sends this to this client.
So he can go and execute this already.
Client There will be a decoding, whatever the message it sends to us in this case.
Idea and so upon indication of reality.
So the output will be send this one.
And this a big movie and praising the writer are put in this first book full of this list.
This is their output.
So if there is any changes for them and this will be reflected in our verbal application.
So the verbal application we need in the input goes on to this published and this trade will be in for
any further changes, anything that happens to this this one.
So if there is any change, I will send this to the client and go and execute that message as they come
in and gets their input.
And this trade will update this in addition.
And if the server program presents on this element and if there is any changes and it goes on reflects
in this web server.
So as it is, we are controlling the client.
We are sending the input and seeing the input in the label application itself.
So that's how we are going to do this one.
So let's go into fittings, procedures, division and command input.
So this is a where the the web server modifies the list.
See, the output is equal to this one.
So threat commander and commander.
So these are the treaties.
So we were creating, uh, the to this one.
So we're treating the unit to server.
So this will initially the actual server that's required to socket that socket.
So you can also say if this is the server so-called.
Soccer.
That sucks.
So we have created soccer.
So let me please be binding to this one.
Binding our VIP orders and the port number.
So for binding, what we need to do is to reason for the connections.
So again, yes, there is enough for connections and it's a connection comma address.
Now we can access that.
So we are accepting that connection.
So from here on, what we don't use it a symbol.
So if you see, if you use the receiver function, the server gets broken by the infinite meeting by
waiting for a message from the client.
So what we're going to do is we were going to create a trade for this.
Let's import the traders we both trading.
And if needed, building that trade off target is equal to.
So we'll be creating another function that is called.
And the connection.
So that's a plus.
So there is, uh, and the connection.
So we'll be ending this connection and we'll be sending some arguments.
We'll be sending these arguments connection.
Karma does because this function should know how to handle the connection.
So more helping handle the connection.
We need to send this connection.
Come out.
It's a arxiv request.
So we need to pass that up.
No, I think it's.
I don't know about this one.
So let's say a connection address.
Let's go and see if there are any errors.
Okay.
So what we're doing here is trading the trade and we need to start this trade does that.
So before starting, what we're gonna do is we are going to do this, uh, trading for this actual trade.
So there is a trade, me opening the trade to this, uh, this so we can access the trade index, not
name.
So we started this trade.
So now we can just sit.
Connection commanders.
So this is how you want to handle this one.
So this is similar sort of record.
We have this email.
Then in the previous review you send.
So what we're going to be professionally we're doing the same across our.
Message to.
Connection to the scene of one 0 to 4 bytes that decode.
So we were receiving the message and we're going to print this message.
And we will be sending this message as that is what it means to that, end quote,
where we shall be as well.
So.
So also see a close connection.
Close connection.
If you think like connection and connection, don't close.
So.
Mhm.
I think they should be.
Actually, we don't need this in the server.
So let's put this government here.
We can use the data we loop through.
So creating the socket.
We are binding to the borders and port and we're are for connections.
Actually you don't need to create another socket as well because one socket should be enough and also
one branch should be enough.
If you try to bend the targets to the same problem, you get an error.
The Pope is already most.
So let's also take this one and add this in the main quote.
So very true if there is in any excerpt.
So we'll be accepting the connection.
And we were trading the trade for.
So we need to render available for this one also.
While message.
So we'll be taking your overall message.
Not easy to convey.
So you might say it is not easy to quit.
Then printing that message.
And sending that message and then converts maybe receiving another message.
So in that sense, and this is the data and if the message is good.
So that means we need to close the connection grows underscore connection of connection.
So this should cause that connection as well.
So I think I did right here.
So it's going to this.
I mean, what is the message here?
And will be spreading the message.
So we will be taking the message if it's not good, printing the message and sending the same message
and again, receiving the message.
Okay.
Bishop word.
I'm writing.
So I think you don't need to change any of these kind of connections.
So we need between you and your decoding, the kind connection.
I think this should be good.
So let's go and run this, Sara.
So right down to Clinton High and you can see the high.
Hello.
So let's go and connect to this this guy and President Clinton and how you can see hello world and you
can see the two kind of applications can concurrently.
So what of this symbol.
So now you can see testing, testing.
We got them again.
So this is how we implement this multithreading in this target blender, multiple grain connections.
So this is this about this video?
This is all for this video.
And actually, they're really seeing some basics.
And in the future, in addition, linking this flask input and output to this socket program.
So that's also border one.
So these are good.
So you can see the high again.
So this connection is separate and this connection is available.
These are very different threads and we can see the input as well.
So that's going to be good.
And this should good here.
So good.
That's all for this video.