buffinator wrote:
> I have two applications that should work together, let's call them A and B.
> 
> The first time A starts, it should open a B process and start
> communicating with it. All other times an A instance starts it should
> simply talk with the B that already is open.
> 
> The problem here is, if I start say 40 A applications at once... how do
> I check if a B is open "fast enough" so that the other A's (not the
> first one) won't spawn new B's?
> 
> Im programming this in windows and am currently using the horrible
> solution in A
> 
> if not win32gui.FindWindow(None, "Name of B"):
>     spawn_B_here()
> 
> This only works well if there is a small time between the A's started
> first...
> 
> What would the best solution for my problem be?
> 
> /buffis

Others have answered your specific question on the forum, I thought
I would make a suggestion.  You should consider writing application B
as a Windows Service that gets started once (maybe even auto start
when the machine boots) and runs forever in the background.  Then have
all your A's bind to it and communication (via sockets, pipes, filesystem,
database, ...).  That way your A's won't have the problem you describe.

Just a suggestion.

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

Reply via email to