Allow me to explain the couple of things to you:
· At the server side: Generally you will create a socket, bind it, and listen for the connections.
· At the client side: Generally you will create a socket and then you will try to connect to the server.
I think the server side is fine in your case but when it comes to the client side you need not have following line:
You should update your code like following example:
ip = '127.0.0.1'
port = 1234
Also please make sure that all your indentations are correct and you are closing your sockets correctly as this is the reason why you are facing this error.