New topic: 

ReadAll vs Read.

<http://forums.realsoftware.com/viewtopic.php?t=30679>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       JustSomeGuy           Post subject: ReadAll vs Read.Posted: Mon 
Oct 26, 2009 2:31 pm                               
Joined: Fri May 11, 2007 11:35 am
Posts: 543              I am implementing a communications protocol over a 
socket.
I was using read all in the data available event.
However all the data was not there yet so read all just returned when it has 
emptied its buffers... (I guess)
This was a bad thing in my code because I thought I had 'ALL' the data but of 
course I didn't.

So I was wondering.. If I know how many bytes I am expecting to arrive should I 
have called read with the number of bytes I was expecting or will Read also 
return when it doesn't have any more data to read?
Do I have to do a loop calling read until I have all the data?
Can I do that in the DataAvailable event?

I noticed that when I called ReadALL that later on i got another data available 
event if I hadn't received all the data in the last readall.     
_________________
A picture paints a thousand words.
A thought paints a thousand pictures.  
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to