sockets – Python ConnectionRefusedError: [Errno 61] Connection refused

sockets – Python ConnectionRefusedError: [Errno 61] Connection refused

This may not answer your original question, but I encountered this error and it was simply that I had not starting the server process first to listen to localhost (127.0.0.1) on the port I chose to test on. In order for the client to connect to localhost, a server must be listening on localhost.

127.0.0.1 means local computer – so client connents with server on the same computer. Client have to use IP from server – like 192.168.0.1.

Check on server:

on Windows (in cmd.exe)

ipconfig

on Linux (in console)

ifconfig

But if you are in different networks then it may not work. ipconfig/ifconfig returns local IP (like 192.168.0.1) which is visible only in local network. Then you may need external IP and setting (redirections) on your and provider routers. External IP can be IP of your router or provider router. You can see your external IP when you visit pages like this http://httpbin.org/ip . But it can still need some work nad it be bigger problem.

sockets – Python ConnectionRefusedError: [Errno 61] Connection refused

This Code Not Valid For Chatting, you have to use unblocking sockets and select module or other async modules

Leave a Reply

Your email address will not be published. Required fields are marked *