Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: communication between Applications



Tom Eager <email@hidden> wrote:

>I require two way communication. Either side can start. The amount of
>data is relative small ( i.e. a few strings with a few longs). The
>frequency of these event is not large and the timing is not critical.

How "not critical" is it?

The simplest scheme I can think of is to write files in a temp directory.
Both apps have a timed thread that wakes up periodically (say 500 ms),
looks for new files destined for it, then reads the file, responds, and
writes the result to a response file, deleting the original file it read.
If it sees no new files, it sleeps for another 500 ms.

Given typical file-system caching, this will incur some disk traffic, but
it's only a few blocks at most.

The hardest part is probably registering a shutdown-hook to delete all the
temp-files on exit. Or perhaps writing a startup evaluator that determines
whether files that seem to be uncleaned-up leftovers really ARE leftovers.
For example a Force Quit may not terminate a process in an orderly enough
fashion, so files may be left and could appear the next time either program
starts up. It would be very bad to interpret those as newly arrived
messages or responses.

-- GG

p.s. you don't have to quote entire messages with list-appended trailers
and all. Simply extract the directly relevant part.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.