on SOCKREAD - Proper Usage - 24/11/04 01:22 AM
When using the on SOCKREAD event, is it necessary to use a loop to keep checking the receive buffer? I notice that many socket scripts don't bother even using a loop. I don't notice any difference using a loop or not. What can happen if I don't use a loop?
Take these two on SOCKREAD codes for example:
Example 1
Example 2
Both do the same thing. Why use a loop?
Take these two on SOCKREAD codes for example:
Example 1
Code:
on *:sockread:test:{ if ($sockerr > 0) { return } sockread %temp if ($sockbr == 0) { return } echo -a %temp }
Example 2
Code:
on *:sockread:test:{ if ($sockerr > 0) { return } :nextread sockread %temp if ($sockbr == 0) { return } echo -a %temp goto nextread }
Both do the same thing. Why use a loop?