I have a form (frmMain) that spawns a thread (thRemote) that deals with all networking - it in turn spawns a certain number of threads, tcp listeners (thTcpListener) one for each client...
From a Server-side point of view:: Now, when everyone (clients) is ready to proceed (at a certain point) the Server sends a "Start" message to all clients and now must wait for all clients to respond with a "Ready" message before the main thread (thRemote) sends a "GO" message to all clients and then continues (launches).
Specifically, when the tcp listener threads (thTcpListener) recieve a "Ready" message from the client it needs to 'somehow' tell 'thRemote' that this client has responded and is ready.
And somewhere in 'thRemote' I need to be able to check to see everytime I get a "ready" from one of my tcp listener threads if that was the last one I needed and now to continue (send the "GO" message, etc...)
Thing is - I am unsure how to accomplish this task properly - I imagine I could use a DELEGATE function off thRemote that I fire from within my tcp listener threads that increases a counter until I reach my target... Or maybe using EVENTS? or Polling the threads? I am really unsure as to the best course of action...
Any ideas, hints, and help would be greatly appreciated, thanks
From a Server-side point of view:: Now, when everyone (clients) is ready to proceed (at a certain point) the Server sends a "Start" message to all clients and now must wait for all clients to respond with a "Ready" message before the main thread (thRemote) sends a "GO" message to all clients and then continues (launches).
Specifically, when the tcp listener threads (thTcpListener) recieve a "Ready" message from the client it needs to 'somehow' tell 'thRemote' that this client has responded and is ready.
And somewhere in 'thRemote' I need to be able to check to see everytime I get a "ready" from one of my tcp listener threads if that was the last one I needed and now to continue (send the "GO" message, etc...)
Thing is - I am unsure how to accomplish this task properly - I imagine I could use a DELEGATE function off thRemote that I fire from within my tcp listener threads that increases a counter until I reach my target... Or maybe using EVENTS? or Polling the threads? I am really unsure as to the best course of action...
Any ideas, hints, and help would be greatly appreciated, thanks