I have written a little bot-style program to help me at work. It runs on about 60 machines and I wrote a seperate commander program to control them all. I use it for inserting reg keys and such. The first thing the commander does when starting up is send a broadcast datagram out onto the subnet to all bots listening on port 2113. They each respond by sending there local info and ip back to the commander. My problem is that they all were trying to respond at the same time and half of the responses weren't getting through to the commander because they respond with UDP packets also. My solution to this was to have the bot use it's ip address as a timer and send the response when it finishes looping. Like this:



mov eax, local_ip
mov edx, 0
mov ecx, 10
div ecx
mov ecx, eax
@584: nop
loop @584
invoke sendto, blah, blah...


It is working fine but this seems like a really crude solution. Is there a more elegant way to solve the problem. I thought of WM_TIMER also but maybe there is an even better concept to put in place. Any ideas would be great.
Posted on 2002-01-08 11:06:08 by rdaneel
During the bot install process it could ask for a time to wait before responding and this would be stored in the registry. Once the bot is run it would read this value and then call Sleep before responding to a broadcast message
Posted on 2002-01-08 19:59:41 by Quantum