I was following the real-time flash game tutorial. It mentioned about grouping key events and broadcast it at 25ms intervals to avoid bad player key meshing that can flood the network:
If looked at from a worst case scenario, event synchronization can be dangerous. If a user presses keys rapidly enough he could in-advertently flood the network (or do it on purpose, as a network attack. It's even worse if he has a macro).
To combat this, you can set a hard cap to the number of event messages sent by sending them in bursts. This will solve the flooding issue above, in exchange for a slight added delay to the messages. To accomplish this, we set up a very fast timer (around 25 ms) and send any events that have occurred in this time period in one single message (if there are no events, we don't send a message). This also helps us reduce the added overhead by sending them in a single message.
I added a timer to broad cast each key message each 25ms (if msg.count ! = 0 ).. Any player should have only one key input in this period... ...
How can I do this..?