anyone found a way around 4-5 second latency in read from process?

Josh Mellicker josh at dvcreators.net
Mon Feb 8 17:51:16 CST 2010


Thanks Sarah! That could be just the ticket for some projects.

I wonder if there is any way to designate a pipe in memory, rather than a text file on disk... I fear the constant disk access might disrupt other things going on.

I wonder if a "generic external" could be written for the sole purpose of porting commands from Rev to external executables, and receiving the output... such that you would need to define the type of data when sending the command from Rev... just dreaming here...


On Feb 8, 2010, at 2:09 PM, Sarah Reichelt wrote:

> On Tue, Feb 9, 2010 at 6:24 AM, Josh Mellicker <josh at dvcreators.net> wrote:
>> We have been experimenting with many combinations of syntax variants  for "open process"/"read from process" to communicate with various command-line driven executables.
>> 
>> We are using a callback loop to read from process, and have tried from 1 to 800 milliseconds to try and speed up response.
>> 
>> We have tried read from process until lf, until cr, until eof, until empty, etc.
>> 
>> Things are working, but there is always about a 4 - 5 second latency in the "read from process". Usually this doesn't matter, but in our current project it needs to be within a second or less.
>> 
>> 
>> So, I am wondering:
>> 
>> 1. Is there something we could do to eliminate this delay, some syntax we haven't yet tried?
>> 
>> 2. Have other developers noticed this latency in the Rev I/O pipeline?
>> 
>> 3. Would writing an Rev external that served as a middleman between Rev and a command-line driven executable eliminate this problem and provide near real time communication?
>> 
>> 4. Is there another way to communicate with command-line driven executables (other than "shell", which doesn't provide for a callback loop to monitor output)
> 
> 
> I use shell with the output piped to a text file that I can monitor.
> Here is an example script that I use for pinging:
> 
> function checkPing pIP
>    put specialFolderPath("Desktop") & "/ping.txt" into tFileName
>    if there is a file tFileName then delete file tFileName
> 
>    put "ping -c1 -n "  & pIP into tShellCmd
>    put " > " & tFileName & " 2>&1 &" after tShellCmd
>    get shell(tShellCmd)
> 
>    put 0 into timeCheck
>    repeat 50 times
>        add 1 to timeCheck
>        wait 1 tick with messages
>        if there is a file tFileName then
>            put URL ("file:" & tFileName) into tRes
>            if tRes is empty then next repeat  -- file created but no result yet
> 
>            put wordOffset("loss", tRes) into tWord
>            if tWord = 0 then next repeat -- file created but result
> not complete
> 
>            -- if there is a file tFileName then delete file tFileName
>            put word tWord-2 of tRes into tPercent
>            if tPercent = "0%" then return true
>            else return false
>        end if
>    end repeat
> 
>    if there is a file tFileName then delete file tFileName
>    return false
> end checkPing
> 
> Cheers,
> Sarah
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list