• Welcome to Valhalla Legends Archive.
 

VB 6.0: anti flood

Started by Tontow, October 04, 2004, 02:40 PM

Previous topic - Next topic

Tontow

What would be the best way to write an anti flood?  The only way that I have been able to figure out is by useing a timer control and an array.

Banana fanna fo fanna


Networks

Quote from: Tontow on October 04, 2004, 02:40 PM
What would be the best way to write an anti flood?  The only way that I have been able to figure out is by useing a timer control and an array.

BINGO! That's how its done!

Grok

Is someone running a VB timer to ask this question every couple months?

Forget the VB timer.  Use a Windows timer to schedule the next opportunity to send data.  You can calculate the delay time based on the formula which others have come up with.  It is a minimal "safe" delay time for anti-flood.  Have you Windows timer call your SendProc.  Even then recalculate the delay.  If the delay is down to 0, go ahead and send, otherwise reset your timer and quit.

LivedKrad

Well, I thought an interesting way to do one would be to only allow 5 messages (items) into a listbox at a time. Use the Windows time to calculate (maybe 5 seconds), and send each item.

Networks

#5
Quote from: LivedKrad on October 04, 2004, 04:58 PM
Well, I thought an interesting way to do one would be to only allow 5 messages (items) into a listbox at a time. Use the Windows time to calculate (maybe 5 seconds), and send each item.

In a LISTBOX!? ohh emm gee *cough* array *cough*

Grok is right though SetTimer() and KillTimer() are better not to mention basically easy.

SendProc?

Grok

Quote from: Networks on October 04, 2004, 05:17 PM
SendProc?

By SendProc I mean "your own procedure which serves as the only point from which data is sent."  This SendProc would be responsible for validating that the next message on the queue would not violate the anti-flood mechanism.  If so, it would SetTimer again and exit without sending the message.

hismajesty

Quote from: LivedKrad on October 04, 2004, 04:58 PM
Well, I thought an interesting way to do one would be to only allow 5 messages (items) into a listbox at a time. Use the Windows time to calculate (maybe 5 seconds), and send each item.

Don't use a form control to replace something that doesn't need a form control. My first queue used a listbox, and it was horrible.

Tontow

Thank you Grok and Networks.  That is exactly the type of responceses that I was hopeing to get.
( I post "better way to do this" posts because I know that there is most likely a better way of doing somthing.  Even ways of doing somthing differently often help.)

One thing tho, I was unable to lookup SetTimer() and KillTimer() on the msdn reference library, may i please have an example


LivedKrad

Quote from: hismajesty[yL] on October 04, 2004, 06:12 PM
Quote from: LivedKrad on October 04, 2004, 04:58 PM
Well, I thought an interesting way to do one would be to only allow 5 messages (items) into a listbox at a time. Use the Windows time to calculate (maybe 5 seconds), and send each item.

Don't use a form control to replace something that doesn't need a form control. My first queue used a listbox, and it was horrible.

My purpose of describing this way of doing it was to provide an (easy) way of doing one.