So it's picking up the chant.
What application.
What we can do is we can start up with the new package for now and let's call it this chat.
OK so I call this chat board and then let me begin a new fight and file in that let me call it as client.
And of course we're going to have one more.
Let me call this new python file and a server.
It's now because there are two coins insurers open you know exactly you have a chat server a checkout
line and a networking server networking client which is another package altogether.
So we're going to be able to chat but all of them.
OK.
So steps are the starting few steps of the same where the import socket create a socket by saying socket
that socket.
So you need to create a Quine's arcade by saying Quine underskirt sacque rate equal to.
So there's your client socket which you need to use for connecting to the server.
So let me connect to the server client socket connect.
OK so you're connecting to the server let me call let me call the server to be at a particular the locals
address right.
Local host it's at the same address but the port Demaris 42000 right Klein socket that connect.
OK.
So once you connect I need to send and receive right.
Two things that needs to be done up to now.
So do this much even on the server side where.
Let me say I'm poat socket.
I create a socket object by saying socket socket.
And let me call this a server socket.
Great.
And then of course the server socket will do well.
Let's say it will what it has to do is it has to let's say bind itself right bind itself to a cross.
It has to be empty.
Come on come on a boat with just two towers.
Right.
So which I can give it later.
I can get some outside number.
So come up post ups pope number or two thousand.
Write so I bound it to a particular part.
Now of course this also when you connect you need to have a couple that won't work if it's not a topple
because you can have only one parent meter in this particular connect mentors.
Right.
So you connect to this particular you bind them to a particular port number and after you bind so socket
or bind what you can do is you know to bind them.
You need to keep listening to the server socket.
Listen that's where you get the clients.
Of course you need to accept it.
Let's say Services had died.
Except now this excerpt will return to you to things that is kind.
Come on.
Here are two things a return to you the connection and the address.
Two things which you need to store it in case the con is another.
As you know it is just another object which you can use for for connecting.
Right.
OK.
So with this done all you can do is consummated yours finds the server socket.
Except now all that can be done is let's say
up to you get that kind come a DVR.
I need to say talk send data as well as I received it.
Both must happen simultaneously both from the client side and from the server side.
Both must happen at the same time.
Right.
That's what we need to do both client side and the service.
So what we need to do is we do have to trace which means basically for now a main thread and a part
time thread right where def can be you know this particular there can be one matter.
It is for receiving data receiving data.
OK.
And there can be another method for sending.
Right.
So let's say I use one method for receiving data.
Another method for sending.
OK.
Now in receiving what I wan in receiving data is I need to do kind Dorte RACV I need to keep receiving
at least thousand bytes from the server side and whatever I get I will have it in data and after I get
data I can just for now aim to do data to decode because it's in bytes I need to decode that.
And after I decode it I need to just print it by saying OK rather de-code I understand that the data
de-code But what is this data.
This data is coming from the server.
So a typical server will have something like this server in space Kummer data the teacher great.
So you don't the space will be all provided by the CEP mattered so that space will all get there.
So the server has and this particular data which I received and they print on my screen so this is preceded
apart but sending the pod is where I need to send data by saying my saying you know I need to take something
from the user let me put something in the user and then send it out.
Let's input enter data to be our.
Don't say anything just let it be as it is.
OK.
Now whatever you input OK whatever your input.
I of course it's going to be empty string for now.
I need to take that into I need to take that into let's say user input right.
That's user input.
Now what can you do with this particular data.
I need to send it to the server after encoding.
So user input data in code that encode I need to encode this and then send it to the server by saying
come on Nakhon sorry uncandid receive.
I made a mistake out here too.
It's not Kollin but coiners core socket.
That's Conne will come on the server side.
This will be the client the socket Daut send our.
So I send data on to the client socket site and so encode it and send it there.
So these are two functions so I need to create one thread.
So the main so I can have one thread for sending and one thread for receiving.
Right.
So let me see I create a thread.
Let me say T is equal to thread.
I create a thread so it tells me there is.
It shows me an on the line saying that no unresolved reference thread.
There is no such thread which means I need to import
from trailing import thread.
Right so I need to import trade out there and I need to say after creating the thread I need to say
what is my target.
Let me put my received data as my target.
Receiving the error can keep happening.
You know as a thread it can keep happening again and again.