Read from socket async?

David Vaughan drvaughan55 at
Sun Feb 10 02:01:01 EST 2002

In a post which I accidentally lost Scott Raney said to Gary Denis that 
"read from...with message" is asynchronous. In what respect, please?

I ran the following script

local lcounter

on mouseUp
   global sname
   put zero into lcounter
   repeat 10
     read from socket sname until return with message "dataAdded"
     add 1 to lcounter
     put lcounter into field "f2"
   end repeat
end mouseUp

on dataAdded portName,info
   wait for 1 seconds
   put info after field "f1"
   subtract 1 from lcounter
   put lcounter into field "f2"
end dataAdded

Consistent with other behaviour of Rev, the counter visibly counted up 
to ten in the repeat loop then counted back down again, as the stacked 
"dataAdded" messages were executed after the mouseUp handler finally 
exited. I would call this synchronous behaviour, consistent with the 
blocking behaviour of all Rev handlers. It is exactly as if one did not 
use the msgname option but followed the "read" with "send dataAdded  && 
it to me". Am I correct, Rev people?

Incidentally, my building this test was somewhat impeded by omissions in 
the documentation. The stated syntax in Transcript Help is:
   read from socket ... [with message msgname]
and under "Notes:" says:
   the parameter is the socketID
You will notice in my script that there are two implicit parameters to 
the message, and that this is undocumented on the Help card. Also, it is 
undocumented that "it", which normally contains the data after the read, 
does not when you use the msgname option. Would you mind adding these to 
your copious list please, Jeanne?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1684 bytes
Desc: not available
URL: <>

More information about the Use-livecode mailing list