Socket Server
https://docs.python.org/3/library/socketserver.html#socketserver.TCPServer
Web servers can forward requests to other servers.
For this to happen, another server has to be listening.
If you set up a server to listen on port 5000, check it’s actually listening by using
netstat -tuln
in the result, should see a line like:
tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN
if your list is too long, pipe the results of netstat to a grab function since you already know which port want to check for
netstat -tuln | grep 5000
Notes on stopping and re-starting the python based custom server listening on port 5000
- modified the server.py file
- ctrl+C on the tmux terminal running the server
- site address served by server.py no longer accessible from www
- tried to start the modified server.py with a new python process
OSError: [Errno 98] Address already in use
5. re-run #4 after some seconds → successful
Serving on port 5000
6. site address serving file again
This is distinct from the websocket , which is a communication method that uses http to start with and then moves on to a different protocol for interaction betw. client and server.
Web Socket Protocol: https://datatracker.ietf.org/doc/html/rfc6455