iphone - Asynchronous IO with CFReadStream -
This is a brother question I am using CF ReadStreamScheduledRuleLuleup and CF ReadSteam with blocking to do Asynchronous IO How can all dates be secured safely?
Assume the actual size of the message was 1200 (but we do not know), and the size of my reading buffer was 1024. CFReadStreamRead will receive 1024 bytes of data, but since we do not know the message size, we should call CFReadStreamRead again and again. The problem is that since we do not know how much data the stream socket has received, CFRDstream read can be blocked by another call. How can we avoid this problem?
Thank you!
call again CFReadStreamHasBytesAvailable ()
to see if it Still it is safe to read (or if the only way to know is to try).
Comments
Post a Comment