socket.error: [Errno 61] Connection refused

Hello,

Could somebody please explain what exactly this error means?

socket.error: [Errno 61] Connection refused

Because I get it from a socket test on the client side when I try to connect to the computer hosting the server, all the correct IPs and ports are being used and this is on a local network (192.168.1.* kinda thing).

Hi,

The error itself means that the client machine can’t connect to what ever ip/port you are trying to connect to on the server.

Assuming that the ip and port numbers of the server you are connecting to from the client machine are correct then there could be a couple of reasons it wont connect.

  1. If the Client Machine has a firewall active on it and is blocking outgoing ip/portnumber address. So the client can’t connect to external machines on the network (the firewall on the client may only be allowing port 80 internet web access). Try disabling any firewall that is active on the Client Machine. Assuming you do that, can you ping the Server Machine Ip address from the Client Machine.

  2. Does the Server Machine have a firewall active and if so are you allowing incoming connection on it from the specific ip address/port.

That pretty much all I can think of as to why you can’t connect without being at the machine.

I switched off my firewalls and that didn’t work so I changed the bind command from

s.bind(('localhost', 8080))

to:

s.bind(('192.168.1.11', 8080))

and it worked! (192.168.1.11 is the IP of the machine in question).

i have the same problem, It doesn´t work for me