Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Tontow on October 04, 2004, 02:40 PM

Title: VB 6.0: anti flood
Post by: 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.
Title: Re: VB 6.0: anti flood
Post by: Banana fanna fo fanna on October 04, 2004, 02:42 PM
That sounds good.
Title: Re: VB 6.0: anti flood
Post by: Networks on October 04, 2004, 02:43 PM
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!
Title: Re: VB 6.0: anti flood
Post by: Grok on October 04, 2004, 04:08 PM
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.
Title: Re: VB 6.0: anti flood
Post by: 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.
Title: Re: VB 6.0: anti flood
Post by: Networks on October 04, 2004, 05:17 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.

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

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

SendProc?
Title: Re: VB 6.0: anti flood
Post by: Grok on October 04, 2004, 06:10 PM
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.
Title: Re: VB 6.0: anti flood
Post by: hismajesty 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.
Title: Re: VB 6.0: anti flood
Post by: Tontow on October 04, 2004, 10:33 PM
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
Title: Re: VB 6.0: anti flood
Post by: Grok on October 05, 2004, 03:13 AM
Click for MSDN Library SetTimer Function (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/settimer.asp)

Click for MSDN Library KillTimer Function (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Timers/TimerReference/TimerFunctions/KillTimer.asp)
Title: Re: VB 6.0: anti flood
Post by: LivedKrad on October 05, 2004, 04:42 PM
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.