goat...@gmail.com wrote:
In my python code I use subprocess.Popen to run and external program
who will listen to a TCP port. And I also create a socket to connect
to the TCP port that the external program is listening.
I will get 'Connection refused, errno=111' when I try to socket.connect
().

Looks like a race. The first process tries to connect before the external program gets through socket.listen(). If you think about it, it's not that surprising.

But if I run my subprocess.Popen code and socket code in two separate
python process. Socket will connect just fine.

It's still a race condition even if the side you want to win almost always does.


--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to