All right, now let's run network programming with tons of it and we will learn about this circuits
interaction and we are also building some small tools related to this network eye with Peyton.
So let's get started.
So these circuits are building blocks for natural programming, so any higher level modules will be
using these targets.
And Target is a pair of IP address and the number.
So IP address is a unique address that defines a computer and that identifies a computer in this network,
inalienable and no ideological book on which the service runs.
OK, so this combination can be treated as a socket and this Wauconda transporter of this uh oh is a
model.
So these sockets establish the connection to this IP address and support and defines this how this transfer
can be taken either to be a reality and we can communicate with the network operations using socket.
This is the main important thing with sockets.
We can communicate with, uh, the network applications using the circuit, even with local network
applications.
So many networking modules were built based on the socket.
So there are so many modules and maps, Kappy and these are built on circuits.
So this is a fundamental networking module for, uh, Saagar.
Natural programming, even some models use the sockets in the back of the seat.
They need to communicate with other networking applications so they need the circuits.
So this socket is a very important and it must be done, uh, even by the normal pattern programmers.
So it will be very helpful.
So let's run about this, uh, some of the functions we need to use for the python circuits.
So the concept is simple, but the syntax will be very easier in Python.
So this is the server functions and these are the client functions.
So before, uh, starting the server, uh, we need to call the socket function.
We need to create a socket for that.
We use a socket function and then we need to bind that socket to particular.
But no.
But IP address and what number we can also bring it to localhost or any other interfaces, so after
reminding you you need to go on listening for incoming connections.
So the father was start up and receiving foreign government connections, so whenever on the currency,
we could all get in the same manner, all the service, but instead of binding and reasoning, we can
act.
And whenever we send we said to this server, we cannot use this IP address.
And the number that is we use it here because the authorities are in a bind and it is on this IP address
and phone number Switchfoot.
And then we use the correct function to connect to this source.
And then whenever there is an incoming function from the client, then the server calls this excerpt
function.
So up to here, the P2P driven handshake, uh, was completed.
You, as you guys know, deceptively simple connect to the true handshake.
As we know from here on, what we can start sending messages from to and from.
So this model has seen that first plane sends the message, then said, what is this?
And then it will send a message to the ground and vice versa.
So then we can, uh, call this cross-functional to call this, uh, uh, connection.
And afterwards, Sarver's target can also cause the connection.
So the basic idea of this server and and the client is in this socket, we can, uh, communicate using
this the socket functions.
So first we need to run the server because without the server client, Karakoram to, uh, the server.
So let's go ahead and program these functions and see how this looks like.
So I'm using this virtually all with the record and I have created to and Grinder.
So first we need to import this socket and socket module is built in the python installation.
If you have installed this python and no need to worry about that.
So import socket.
So afterwards, we need to create this awkward object.
We say, yes, this equals to.
Soccer, but soccer inside this soccer module, there is a soccer function, so to that function, you
need to pass two parameters.
Those two parameters define what type of soccer we are going to create a TCAP or would it be an argument
is to share the IP version for our version six one.
So, you know, this is soccer, not a final score in it.
So if I understand that this family and it represents the family of I'll be watching for this, it means
that we are bending towards we are going to create a soccer that is going to result on that.
I'd be watching for this.
And second, uh, argument you want to pass is soccer, not soccer team.
This is a big day for a package that is for Europe, you can also create a razzak as well.
But for now, we are going to create this soccer and of.
This is the streaming circuit and that is a Tsipi soccer because there is a connection establishment.
So that's why we are going to create this IP version for and that is soccer.
So now we want to say, yes, not a buy and we need to pass the IP address and the number as a couple.
So put those brackets and share 127 dot 0.01 comma.
Specify this point number.
That's one, two, three, four AZAPO.
So now my circuit has been created and successfully we are going to build on this.
But no.
All right, now, what we're going to say is we need to say, yes, that this.
It is enough, we need to pass the number, so these numbers before that, how many corrections you
want to suppose?
Uh, if I say five here, I started it and then the third is for five corrections after getting five
successful corrections, then stop visiting.
We cannot count more than five corrections to discover.
All right, now we need to say it's not acceptable, so we are accepting this connection.
So whenever there is an excerpt, it will, uh, return the two values.
That is the current descriptor, comma address.
So this is a good descriptor and this is also Kosaka, if you are working with fighters, you say that
the fire Cooper is opening the fire.
So in this event, this is a soccer descriptor and we can perform the operations with this soccer descriptor.
And this is not an exact function returns to very kind of, uh, the incoming connections object and
then Darters.
And you can just print out this address.
So I to this is the first part and we will call for further, but for now, let's go to this grand and
let's import soccer.
And we need to create this socket in the same way as we created before soccer, not soccer stuff inside
the soccer grass soccer match, the socket function.
So we are going to create the same IP version four, and that is soccer.
So now we don't need to write this binder or accept all we need to say is see that kind of stuff.
And we need to, uh, pass the upper.
That is one condition, not the right one, and the number is one, two, three, four.
So I think we can send messages.
So she said it doesn't matter and we can send our fight and we need to end this so important t you cannot
send the strings, A, you need to encode this and this encoding will convert, uh, into the white.
So important to you can send as a thing, but importantly, they have specifically put a rule that you
cannot send in the, uh, socket or in the network you need to send as a by Sunday.
So here we are sending the high and we need to receive here.
So what we want to do is you want to set up so you want to receive the message from this Cranton.
So that message is he to greencard.
Currently not receive any specified number of bytes you want to receive, so two zero four two zero
four debates are needed to decode that message.
So it will be in a real format, like you will see the Russians and bees because the quotations and
the format like that will be able to this.
And you can get this one print off message.
So now we can send a message as well.
You can say Clent.
Grindrod, sorry, Trent Lott sent off say hello, I am his.
Sarver, I know you said that, and so you can also hear the new same message and you can assign that
string to this message, but I'm just telling you, the syntax of these functions, don't worry, in
the next few years.
Well, uh, as I need to evitable.
Now we are sending this hello, I am Savar to the screen, so now we need to see this same message.
Is he to see that received at the same, uh, function syntax?
You notice a number of bytes.
Uh, and we need to decode this one.
And again, this message.
So now you got to see the message and we can see that close, we are going to just close this communication
so we can just say first we need to call this a a good descriptor.
Grinder, not cross.
So if there are any other connections, then you need to cross those connections also.
And then finally, you need to call this soccer for the soccer.
All right.
Let's review our code once again.
We are importing soccer.
We have created IP Version four and DCP soccer, and we are bringing it to this local host and one,
two, three, four.
And we are going to listen for five connections.
Whenever there is a, uh, connection, we are going to accept this one.
And we are putting the connection object on the ground.
And the address address is just like this, this IP address and the number.
And we are receiving the message first and we are painting that we are sending another message and we
are closing that.
So as long as as soon as this country has this message, it will it will close the connection.
So let's go ahead and run this one.
So I am running this news issue and we need to.
Oh, I'm just going to open this one.
So let me open this up in Britain ideally, so you can order to ensure the same results we got so far
that we need to open another instance.
Uh, but it's, uh, simple to use this opportunity.
So let's go and run this group therapy first.
We need to run this because without this, he cannot run.
He cannot know that.
So let's run this.
And now it's saying nothing because it's going on listening for corrections.
Let's go ahead and run this group.
As you can see now, we have got the message.
Hello, I am Sarva and the connection has been close.
So this is from the claim.
So great because we are doing already the message.
So now let's go there and see what happened on.
So we have printed this address.
So this is how I dress.
So one three zero zero zero one that is localhost.
And because this model I have been running on my computer and then the board number so far, I drew
Frassoni.
So this spot is selected by the window scanner itself.
So it will do this some random but random report and then it will use to connect to this or people.
So that is the address dateable of IP address on the bottom.
And then we are receiving the message from the client, which is right.
And we are printing here.
So we got the output right and then we are sending hello server and we are receiving we received it
on the screen and then we are closed the connection.
So that's about this basic communication establishment between the Clinton server is in the python suckage.