brew install rcp on mac
brew install inetutils
Here is what the above code is Doing:
1. We’re importing the socket module, which is necessary because we’re going to be creating a socket.
2. We’re creating a socket object.
3. We’re binding our socket to the localhost, and telling our socket to listen for connections on port 80.
4. We’re telling our socket to start listening with a maximum number of 1 queued connections.
5. We’re accepting a connection.
6. We’re printing out the client’s address.
7. We’re receiving data from the client and printing it out.
8. We’re sending data back to the client.
9. We’re closing the connection.