A message for data waiting at a socket?
Doug Lerner
doug at webcrossing.com
Sat Jan 3 00:34:35 EST 2004
On 1/3/04 2:26 PM, "Dar Scott" <dsc at swcp.com> wrote:
>
> On Friday, January 2, 2004, at 10:00 PM, Doug Lerner wrote:
>
>> Neither one seems to have anything to do with the push of data from the
>> other side, does it? I mean, in both cases you still have to invoke the
>> "read from socket" command again somehow, like I am already doing,
>> wouldn't
>> you?
>
> Do the next read in the message handler unless the socket was closed.
>
> The message handler will then be called each time some data is
> available. For small messages, this is usually at the push.
>
> Dar Scott
Ah. I see what you are saying. Start it out by invoking the read as I am
doing now. But then, instead of polling, invoke the next read in the message
handler itself using the "with message" option. Then when data has been
completely read it will call itself to process it again.
But... what happens if no data is present? Wouldn't it cause a
cpu-intensive-slowing-down loop like:
read
nothing's there so finished so signal read
?
doug
More information about the use-livecode
mailing list