realbasic-nug
[Top] [All Lists]

Re: DataAvailable doesn't fire often enough

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: DataAvailable doesn't fire often enough
From: Jonathan Johnson <jonj at realsoftware dot com>
Date: Wed, 31 Aug 2005 20:17:14 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tvEAgfzMSPXxjsrw0wLpoxd8v1JzzpKaBrbZ4aYAYlIZN/fykDPHKkpWCTMYKr2y3nC9TzqcattWcW1Rjk0vTSmiIP9XHzT5Nlg8X/F7LKdUI5LdTiEeBUGiLrYfG2x3QldCrOw6M1lljgA9sSnbNh/o7Xpyai0lp7qxlQVyG5g=
References: <801EA98A-A6CA-426F-A6D1-B26BC56BFC18 at mac dot com>
On 8/31/05, Stefan Pantke <seaside dot ki at mac dot com> wrote:

> - When does DataAvailable really fires?

It fires when more data has been received, and you are able to read
more. If you don't read all of the data in the DataAvailable event,
and leave data on the buffer, it won't fire it again until more data
has arrived. So, the loop like you described can be quite common --
process chunks of data until we can't process anymore, and then wait
for the next event.

> - If new data arrives while DataAvailable is currently executing, can it
> overrun another DataAvailable event or will - when the current
> DataAvailable
> event finishes - another DataAvailble fire?

No, it will not execute it twice at the same time. DataAvailable is
always fired from the main thread, and thus cannot have two separate
execution paths. The next time through the event loop, the sockets
will be polled again, and if more data has become available, your
DataAvailable event will fire.

HTH,
Jon


-- 
Jonathan Johnson
REAL Software, Inc.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>