|The stupid question is the question not asked|
Communication between seperate scriptsby Jouke (Curate)
|on Apr 06, 2004 at 08:30 UTC||Need Help??|
Jouke has asked for the wisdom of the Perl Monks concerning the following question:
I want to write two scripts, call them the server and the client, however, since it's intended to run on standalone as well as networked computers, I don't want to communicate over TCP/IP or any other networking protocol for that matter. Another thing involved here is that the primary target Operating System is Windows.
The server is supposed to watch the parallel port (using much of the code of Adremo electrical wheelchair testutility) and whenever it detects a change in the values it reads it should set a flag and allow a client program to see that, and get the value the server just read. The problem is certainly not how to read these values, or how to write a deamon/system tray script. I know how to do this, so please read on.
update: From discussion on the CB it is clear that this posting is a bit too vague. Let me explain a bit better: Currently all scripts I wrote that can be controlled from the mentioned wheelchair all have the same code that checks the parallel port for changes. I want to pull that part of the code out of those scripts and have a server/deamon running that takes care of communicating with the wheelchair. Then (possibly) multiple clients (pVoice, pStory, pShell etcetera) can run and connect to that server and don't have to worry about communicating with the parallel port themselves anymore. However, the values the server reads change very quickly (it may have a certain value for only 1 or 2 cycles (a cycle is about 10ms), that's why I presumed that writing the information to a file wouldn't be fast enough.
The client is a totally seperate script that can be fired up whenever the enduser likes. This script should be able to 'connect' in a certain way to the server and watch the flags the server sets or clears.
I know about signals, pipes and stuff, but I wonder what would be the best way to let those scripts communicate with each other. Writing stuff to a file isn't really an option since that's too slow; the value read from the parallel port may have changed already before the client detects the change.
Does anyone have any experience in writing something like this, without using networking?
Jouke Visser, Perl 'Adept'
Using Perl to help the disabled: pVoice and pStory