Introduction to sockets, hi, everyone, and welcome back to the course.
In this section, we're going to talk about sockets, which are one of the most important concepts when
talking about connecting to different networks, specifically with Python.
So a socket is the base of the IP.
The sockets are used to connect to applications and make them communicate between themselves.
You can imagine the socket as a tunnel between two applications that has a specific port name and so
on and so forth.
So using this to know one application actually has some bridge between itself and the other application,
and then they can exchange data between themselves in order to have some role in the communication between
those two applications.
Of course, we're using the protocols that we already talked about in this and just sort of the FTB
HTP and SMPTE protocols.
Of course, there's our type of protocol that is used here, and you can find all of them online, of
course.
But these are the main protocols.
We are going to be talking in this section and the main protocols with which we are going to conduct
our tests.
So in order for us to enable two applications to communicate between themselves, we, of course, need
some type of components to enable this thing happening in reality.
And for that reason, we created the concept of the server or the listener.
So server usually turns on Eliseo's and listens for the communication on a specific port.
And the port basically describes the tunnel is basically the number of the tunnel.
So imagine the server as a machine or a virtual machine in our case that we simply turn on and it stays
in a passive state until it is not awake from some other application that is calling on the port that
is turned on.
And here it comes the client.
So normally the client connects us to the server.
So while the server is on and waiting or listening, then we create a client that is awake in the server.
So it calls a server or on the port that has been stated and basically starts sending requests and the
requests you can imagine as messages.
So it sends messages through that port to the server and then if the server understands these messages.
So if you use the right protocols, then the server could respond with messages that are sent in from
the server to the client.
But usually the most important thing to remember here is that the client initiates the communication
between the server itself.
So we need a server that waits on certain port.
And after that, we need the client to say to us.
Okay, now I know that you're waiting for me.
I'm here now.
Let's communicate.
And then the communication happens.
Then we have, as I said, the trust transmission channel or this is the port or the tunnel that connects
the server and the client.
And we can say that this channel or tunnel or port you can go wherever you like, is basically an answer
to a server and an exit to the client.
So from the client, the signal where the messages exit from the client to this support, and then they
enter the server through the same port.
And finally we have the protocol, which is basically the topic of the conversation between the client
and the server or the language with which they are communicating.
So you can imagine the different protocols like the HTP or SMTP, as are different languages with which
the application and the client can understand themselves.
So if we talk about applications, there are, Trumaine, main applications that are basically using
the sockets.
The first application is a server, which is the application, as we said, that is waiting for connection.
Then you hear the client, which is the application that connects to the server that is waiting.
And then we have the client server, which are basically applications that are client and server at
the same time.
So when you run this type of applications, they are basically having internal clients and servers that
consistently exchange information between themselves and updates on certain features of that application
in order to provide you up to date data.
So here, guys, I decided just to provide you a quick overview, just with three sentences, how the
communication between client and server is working.
And I know that I'm repeating this over and over again, but especially if you're new to the field of
connecting.
Different machines, it is very important to understand this concept before going into the actual coding,
so always if you have any issues understanding about the processes that are happening in the codes that
we were going to write in later on, please refer to the slide and read each of those three sentences,
which are quite straightforward in my opinion.
So the first one is the communication must be initiated by one of the programs, which is called Courland
Program.
The second program waits for the other one to initiate the communication and is called the server program,
which is a program that is basically waiting for the client.
And finally, we have the circuit, which is the basic topic of this section, which we have the circuit,
which is a process that exits from the client machine and it goes straight to the server machine.
In the main objective of the socket is that the server and the client read and the right information
between themselves.
Now, once you know what actually the sockets are and let's talk about the different types of sockets,
because, of course, as anything else, the circuits have different types.
And this is pretty much dependent on the protocols that they're using.
So the socket that we're using here are going to be the Tsipi protocol sockets or the stream which basically
uses the DCP protocol and provide security of the data transmission and security of the data reception.
So by the transmission, I mean the data that is transmitted from the client or the server and the reception
is basically the data that is received from the server.
The other type of sockets are having asynchronous communications that is code.
So did you run and this sockets are using UDP protocol and basically the packets of information here
are travelling in the background type.
But about this, we're going to talk later in more detail.
But this is the basics about sockets and communication between clients and servers, guys.
And I hope this lecture gave you a very good foundation for the code that we are going to be writing
later on.
And that's it.
Thanks very much for watching and I will see you in the next lecture.