A client is a thing, a machine, that speaks (sends data to a server or request data from a server) to servers.
A server is a thing, a machine, that listens to clients, or listens for clients to speak with, and then it speaks (returns some form of data to the client) back to those clients.
The client—server model is a thing made up of a bunch of clients and servers talking to one another.
Question: what happens when you go to a website in your browser?
Your browser (google chrome) is a client, the website is the server (not the actual server)
the browser does not actually know what the website is
all that it knows is that it can communicate with it (speak to it, request stuff from it)
but doesn't actually know what the server represents
it will request information from the server
and then base on that information (based on the response from the server), it will be able to do stuff
when typing the URL bar, at first the browser doesn't even know how to talk to the website (or the server)
what it does behind the scenes, actually, is it makes a DNS query to find out what the IP address of the website is
only then can the browser really speak directly to the website (the server)
once browser knows where the website is with the IP address
it sends a HTTP request to the IP address and specify what port to communicate with
it basically sends a bunch of bytes or characters that are going to get packed into what we call packets in some special format to the website (servers)
the request will also contain the IP address of the browser, or computer
this is the called the source address of the request
after receiving the IP address information, the server will then know where to send the response to
A server usually listens for requests on specific ports
any machine that has a distinct IP address has 16,000 ports that programs on the machine can listen to
therefore, when communication with another machine, you need to specify what port you want to communicate on
most clients actually know the port that they should use, depending on the protocol that they're trying to speak to the server with
eg.
if the client is trying to speak to a server using the HTTP protocol
it is always going to use port 80, which was decided a long time ago
if the client is trying to speak to a server using HTTPS
it will use port 443
after the server receives the request from the browser, the server understands that you are trying to view the HTML of the website
so the server will return the HTML of the website in its response to the client
the client will receive the response and then renders the HTML on the page for you
DNS query: it is a special request, that goes to a predetermined set of servers to request for the ip address of the URL
IP address: it is a unique identifier for a machine
all computers connected to the internet, have ways to find public IP addresses, or at least, they have ways to discover routes to those addresses
this means that the computers can send data to IP addresses
they can send packets of information in the form of bytes, to IP addresses
therefore, a website that was granted an IP address could be a cloud provider (such as google cloud platform)
so what the website creator did was to go to the cloud platform after creating the website, and requested to be given and to reserve an IP address
HTTP: it is a way to send information, that the server is able to understand
the paradigm by which modern systems are designed, which consists of clients requesting data or service from servers and servers providing data or service to clients
it describes the entities and protocols involved in the translation from domain names to IP addresses
typically, machines makes a DNS query to a well known entity which is responsible for returning the IP address (or multiple ones) of the requested domain name in the response