Valhalla Legends Forums Archive | Visual Basic Programming | VB 6.0: anti flood

AuthorMessageTime
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.
October 4, 2004, 7:40 PM
St0rm.iD
That sounds good.
October 4, 2004, 7:42 PM
Networks
[quote author=Tontow link=topic=9009.msg83208#msg83208 date=1096918800]
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.
[/quote]

BINGO! That's how its done!
October 4, 2004, 7:43 PM
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.
October 4, 2004, 9:08 PM
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.
October 4, 2004, 9:58 PM
Networks
[quote author=LivedKrad link=topic=9009.msg83244#msg83244 date=1096927098]
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.
[/quote]

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

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

SendProc?
October 4, 2004, 10:17 PM
Grok
[quote author=Networks link=topic=9009.msg83249#msg83249 date=1096928243]
SendProc?
[/quote]

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.
October 4, 2004, 11:10 PM
hismajesty
[quote author=LivedKrad link=topic=9009.msg83244#msg83244 date=1096927098]
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.
[/quote]

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.
October 4, 2004, 11:12 PM
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
October 5, 2004, 3:33 AM
Grok
Click for MSDN Library SetTimer Function

Click for MSDN Library KillTimer Function
October 5, 2004, 8:13 AM
LivedKrad
[quote author=hismajesty[yL] link=topic=9009.msg83270#msg83270 date=1096931544]
[quote author=LivedKrad link=topic=9009.msg83244#msg83244 date=1096927098]
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.
[/quote]

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.
[/quote]

My purpose of describing this way of doing it was to provide an (easy) way of doing one.
October 5, 2004, 9:42 PM

Search