mIRC Home    About    Download    Register    News    Help

Print Thread
Help file typo? #57122 24/10/03 03:15 AM
Joined: Mar 2003
Posts: 29
Y
YoItsMeRemember Offline OP
Ameglian cow
OP Offline
Ameglian cow
Y
Joined: Mar 2003
Posts: 29
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?

Re: Help file typo? #57123 24/10/03 07:50 AM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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.


* cold edits his posts 24/7
Re: Help file typo? #57124 24/10/03 10:02 AM
Joined: Jan 2003
Posts: 119
A
AKO Offline
Vogon poet
Offline
Vogon poet
A
Joined: Jan 2003
Posts: 119
Just sockread beforehand. I had trouble with this a long time ago when writing my FTP client.

Re: Help file typo? #57125 24/10/03 10:29 AM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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.


* cold edits his posts 24/7