mIRC Homepage
Posted By: YoItsMeRemember Help file typo? - 24/10/03 03:15 AM
Take a look at this (taken from the "Sockets" page in the mIRC help file):

-------------------------------
$sockbr
$sockbr is set to the number of bytes read by a /sockread command. It is used to test whether any information was in fact read from the buffer (see below for more info).
-------------------------------
Note: A single /sockread may not be enough to read the entire buffer. You should keep reading until $sockbr (bytes read) is set to zero.
-------------------------------

Now I could be wrong, but wouldn't $sockbr be equal to 0 BEFORE mIRC reads anything from that socket, and then increase AFTER it reads data from the socket?

For example, if you had....

while ( $sockbr != 0 ) {
sockread -f %text
echo -a %text
}

The sockread would never occur because $sockbr would equal 0 before it reads anything.

Is this a typo or a mistake, or just poorly written?
Posted By: cold Re: Help file typo? - 24/10/03 07:50 AM
Poorly written, I guess. It's really set to 0 at first, and /sockread does fill it, but it also decreases $sockbr right after so it's going to be set to 0 again.
Posted By: AKO Re: Help file typo? - 24/10/03 10:02 AM
Just sockread beforehand. I had trouble with this a long time ago when writing my FTP client.
Posted By: cold Re: Help file typo? - 24/10/03 10:29 AM
Yeah I know, a "do..until" kind of loop would be the way to go. But (s)he's just talking about its mirc.hlp description.
© mIRC Discussion Forums