Jump to content

To Avoid Input Flooding Disconnection


general

Recommended Posts

on admin:TEXT:readusergate:#:{
  var %handle = handle $+ $ticks, %file = user.txt
  if (!$lines(%file)) { msg # There is no Message to read %file . }
  else {
    .fopen %handle %file
    if (!$ferr) {
      while (!$feof) { msg # $fread(%handle) }
      .fclose %handle
    }
  }
}

 

everything is fine with above mentioned codes....but if there are more than 40 lines in file...it causes of input flooding disconnections....

i try to set timer with eatch line..but hell, it is too lengthy process....is it possible to set timer in above mentioned code..that each line shud be msged to $chan with a specific intervel........ to avoid Input Flooding Disconnection

 

your help in this regard will highly be appriciated...

Edited by general
Link to comment
Share on other sites

X-Fusion is indeed correct, however, mine was a modification off of Petertje's code. Here is the snipplet...

;Peter's code, modified abit
alias ss {
  inc %pss | hadd -m slowsend %pss $1-
  var %l = 1 | while ($var(%ssend.*,%l)) { var %i = $($ifmatch,2) | if ($len(%i) < 900) { break } | inc %l }
  set -e %ssend. [ $+ [ $(%l,2) ] ] $addtok(%ssend. [ $+ [ $(%l,2) ] ],%pss,32)
  if (!$timer(slowsend)) .timerslowsend -m 1 300 gosend
} 
alias gosend {
  var %c = $gettok($var(%ssend.*,1),2,46) , %item = $gettok(%ssend. [ $+ [ $(%c,2) ] ],1,32) | %ssend. [ $+ [ $(%c,2) ] ] = $deltok(%ssend. [ $+ [ $(%c,2) ] ],1,32)
  $hget(slowsend,%item) | hdel slowsend %item
  if (!%ssend. [ $+ [ $(%c,2) ] ]) unset %ssend. [ $+ [ $(%c,2) ] ]
  if ($var(%ssend.*,1)) .timerslowsend -m 1 300 gosend
  else unset %ssend.* %pss
}

Simply add it to the remotes file, then with any command you wish to "buffer", put "ss" in front of it, and it will buffer the information with a 300 millisecond gap between sends. This should be enough to stop any flooding from occurring.

So applying my code to your code you get (making sure you add the above snipplet into remotes)...

on admin:TEXT:readusergate:#:{
  var %handle = handle $+ $ticks, %file = user.txt , %l = $lines(%file) , %i = 1
  if (!%l) { msg # There is no Message to read %file . }
  else {
    while (%i <= %l) { ss msg # $read(%file,%i) | inc %i }
  }
}

 

And just to remain unbiased, applying travis' method (as it works for file reads only, i believe)...

on admin:TEXT:readusergate:#:{
  var %handle = handle $+ $ticks, %file = user.txt
  if (!$lines(%file)) { msg # There is no Message to read %file . }
  else play # %file 300
}

With the play command, "300" indiciates the delay in milliseconds, so if you need to slow it down, then do so. But like i said, it only works with file reads and buffer sending them. My snipplet provided in the first option allows you to buffer ANYTHING. Though, writing to a file, and "playing" the file, it will do pretty much the same job, but you just need to know how to code it correctly.

 

Have fun...?

Link to comment
Share on other sites

Yeah I chose the play command since he specified a text file and all his previous code uses text files. I personally do not use text files and so have never used the play command. I use the ss alias. :)

Link to comment
Share on other sites

Omg........Wat a great snipplet is this..........

i msgs almost 600 line......to the room ..and other script users were about to die to see this ..

Bundle of thanx for such nice codes ......both of u .....Travis and fusion.....

in this regard i wud like to know something more about it......

wat if i change

.timerslowsend -m 1 300 gosend
to
.timerslowsend -m 1 500 gosend
still it work fine ....?

im using socketwrite connection ......the codes are posted by Fusion do not works with socketwrite connection ..while with other connection it works fine......

with socketwrite connection on command...

Me : !readuser

8-[├«[H]»┤]- has left the conversation.

8-[├«[H]»┤]- has joined the conversation.

8-[├«[H]»┤]- has made -[├«[H]»┤]- an Owner.

Me : !readuser

8-[├«[H]»┤]- has left the conversation.

8-[├«[H]»┤]- has joined the conversation.

8-[├«[H]»┤]- has made -[├«[H]»┤]- an Owner.

it left and join only but do not read file....

But codes posted by Travis working fine with both socketwrite ans simple conenction.........

its all ok anyway .....now i just want to know if i increase time intervel from 300 to 400 or more wud it effect codes anyway?

 

Link to comment
Share on other sites

Well y ou should really thank TGK and Petertje since they developed the ss and gosend aliases.

 

TGK will be able to address your question best but I would like to see the code you are having trouble with.

Link to comment
Share on other sites

just so you know, i'm not x-fusion! :P (which for some reason some people around here seem to think me and him are the same, we aren't).

as for the timer thing, yes, that is correct, but remember to change both timers, there is one in each of the aliases.

The code that i posted was tested in MSN chat, so they would be suitable for MSN like rooms. And remember, you leave the command as normal, just add "ss" before the command, so there is no difference in the code, except for the added "ss". This is so all your commands will work as normal, and that the commands themselves are buffered, and that it doesn't become restricted.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...