Here is an example code for creating a TCP client in Python:
main.py454 chars24 lines
In this example, the client connects to a server running on 127.0.0.1
(localhost) on port 5005
. It then sends the message "Hello, World!" to the server and waits for a response. Once the response is received, it prints it out to the console and closes the connection.
gistlibby LogSnag