Processing is writing the value of an analog port to a text file. Then I have a flash swf reading the text file. I want to update the swf in real time. However, if processing writes to the file as flash is reading from it, both processes cannot use the file.
With keeping this update in real time, how can I still read from the text file? I realize this is probably more of a flash question but any suggestions are appreciated.
EDIT: Also the reason I am doing it this way is because if i export this certain sketch, the java applet will not show up in the web page.
Files are not really a good method of inter-process communication. Is there any other way you can connect to the flash SWF reader other than through a file (socket? pipe? IPC?)
I'm assuming you're using Windows? On Linux-type systems this shouldn't be a problem as the 'tail' program does this all the time, continuously reading a file as another process is writing to it. Dunno about how Windows handles this.
I suppose you could go with a ping-pong file approach. Write to one file, close it, write to another file, close it, wait for the first file to disappear. In the SWF reader, wait for the first file, read it, delete it, etc. This is really messy and ugly and I feel dirty for even suggesting it
--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons
Files are not really a good method of inter-process communication.
They are. Just not for this sort of communications.
@justmcoyy:
It's my understanding is that Processing is based on Java. It's also my understanding that Java and Sockets go well together. I also believe that Flash does well with Sockets. Can you guess where I'm headed?