Implementing a simple TCP client and TCP server
In this section, we are going to introduce the concepts for creating an application oriented to passing messages between a client and server using the TCP protocol.
The concept behind the development of this application is that the socket server is responsible for accepting client connections from a specific IP address and port.
Implementing a server and client with sockets
In Python, a socket can be created that acts as a client or server. Client sockets are responsible for connecting against a particular host, port, and protocol. The server sockets are responsible for receiving client connections on a particular port and protocol.
The idea behind developing this application is that a client may connect to a given host, port, and protocol by a socket. The socket server, on the other hand, is responsible for receiving client connections within a particular port and protocol:
- First, create a
socket
object for the server...