Python multiprocessing socket.error: [Errno 111] Connection refused?

I am making a simple connection between server and client using multiprocessing in python 2.7.
When I run the client code in a separate python shell, the connection is successful, but when I launch the application as a whole, I get "socket.error: [Errno 111] Connection failed".

This is Traceback:

Traceback (most recent call last): File "./kaboom", line 276, in <module> sequence.run(testEnv) File "/e/m/amoreau/test_edit/kaboom/src/kbmSequence.py", line 271, in run if testEnv.open() != SUCCESS: File "/e/m/amoreau/test_edit/kaboom/src/kbmTestEnv.py", line 518, in open queueManager = resultsClient.QueueServerClient() File "/e/m/amoreau/test_edit/kaboom/resultsClient.py", line 15, in QueueServerClient manager.connect() File "/usr/lib64/python2.6/multiprocessing/managers.py", line 474, in connect conn = Client(self._address, authkey=self._authkey) File "/usr/lib64/python2.6/multiprocessing/connection.py", line 143, in Client c = SocketClient(address) File "/usr/lib64/python2.6/multiprocessing/connection.py", line 263, in SocketClient s.connect(address) File "<string>", line 1, in connect socket.error: [Errno 111] Connection refused 

Why is this happening? I disabled all firewalls.

+4
source share
1 answer

Howdie, I had this problem. I know this is an old answer, but I found the answer in the corresponding question. It is listed below. The problem is that the client is trying to connect to the server before the server created the socket.

Well, that was in my case. The appearance of the server in another process takes a little longer than the client tries to connect. To check, I placed a sleep call in my client and, of course, there were no more errors.

Python socket error - connection failure

0
source

All Articles