Richard Miller wrote:
The computer in question is not set up with networking.

I'm not sure if UDP on the same machine is prevented even without external networking enabled. Maybe someone here can explain.

But if all you need is to pass some info from one app to another, depending on the frequency of the exchange you may find using a file isn't a bad option.

While it's true that accessing a file's contents is relatively slow, that is relative. More importantly, checking for the existence of a file is much faster than checking its contents, in many cases quite acceptably so.

You could conceivably have the listening app check a folder in specialFolderPath("temporary") for a file of a specific and unlikely-to-be-used name (e.g., "MySpecialDataFile34583895"), using a timer set for, say, once every half-second or so, depending on the frequency you need (could be less, could be more; the less often it checks the better of course).

The sending app would write to that file any time it needs to send info to the other app, and the other app would see that it's there and if it is then it reads it, deletes the file, and does whatever it needs with the data:

on ListenForData
  put (specialFolderPath("temporary")&"/MySpecialDataFile34583895" \
    into tTempFile
  if there is a file tTempFile then
    put url ("file:"&tTempFile) into tMyData
    delete file tTempFile
    -- do something with the data here:

  end if
  send "ListenForData" to me in 500 millisecs -- half a second
end ListenForData


On a relatively slow Mac (1GHz G4) it takes about a quarter millisecond to get the file name using specialFolderPath and check its existence.

If you get the file name only once and store it in a variable, the time to just check for its existence drops to only 0.0165 ms:


local sTempFile

on InitListening
  put (specialFolderPath("temporary")&"/MySpecialDataFile34583895" \
    into sTempFile
  ListenForData
end InitListening


on ListenForData
  if there is a file sTempFile then
    put url ("file:"&sTempFile) into tMyData
    delete file sTempFile
    -- do something with the data here:

  end if
  send "ListenForData" to me in 500 millisecs
end ListenForData


--
 Richard Gaskin
 Managing Editor, revJournal
 _______________________________________________________
 Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to