It looks like your client is trying to connect to a non-existent server. In a shell window, run:
$ nc -l 5000
before running your Python code. It will act as a server listening on port 5000 for you to connect to. Then you can play with typing into your Python window and seeing it appear in the other terminal and vice versa.