Python 2.7: socket.error error [Errno 111] - connection refused

I created a TCP server program (see server.py ) to access the terminal of another computer (see client.py ). When I use the client and server locally (only on my computer), everything is fine, however, when the client sends a request from another computer, I get this message on the client side:

Traceback (most recent call last): File "client.py", line 11, in <module> client.connect((serverIP, serverPort)) File "/usr/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 111] Connection refused 

Note: a server is a computer that a client accesses.

+5
source share
2 answers

I decided. I had to use the IP address that was included when starting ifconfig ( 192.168.1.*** ). I was attached to localhost and therefore I could not remotely connect to the server.

+1
source

“Connection refused” means that nothing was heard on the IP port you were trying to connect to.

It comes from the target system, which means that a connection request has been received and the failure has returned, so this is not a problem with the firewall.

+4
source

All Articles