It is a server running on the physical/vm server that receives the request from the client using the HTTP protocol and returns the HTTP response.
The client can be a website or any other program that is using HTTP to communicate over the network.
We make use of sockets
. Socket programming is a way of connecting two nodes on a network to communicate with each other. One socket(node) listens on a particular port at an IP, while the other socket reaches out to the other to form a connection.
Sockets basics: https://www.geeksforgeeks.org/socket-programming-python
Socket options: https://notes.shichao.io/unp/ch7/#getsockopt-and-setsockopt-functions
Before the client sends the http
request, it needs to establish the TCP
connection with the web server.
Once the connection is established, the client sends the HTTP request over the TCP connection and waits for the HTTP response from the webserver.
The TCP connection is initiated from the client and to establish that, both client and server use sockets
.
Before we move ahead, we need to understand what WSGI is.
The Web Server Gateway Interface is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. (coming straight at'ya via wiki)
All the Web Servers must implement the WSGI integration which allows us to use and integrate any python web framework onto the Web Server. Think of it as a protocol.
NOTE: WSGI support needs to be handled from both the webserver and the weframework.
Sources: