444 Chapter 12
Platform Specifics and Web Monitoring
Communicating with Rocky Mountain Basic Programs
pipes that are
created
automatically
If pipes do not exist before To/From Rocky
Mountain Basic
operates, the following pipes are
created automatically:
/tmp/to_rmb
/tmp/from_rmb
Note, however, that if the pipes exist beforehand, the
program runs more quickly.
creating
additional
pipes
To create additional pipes, use the operating system
command
mknod.
opening and
closing pipes
Rocky Mountain Basic pipes (which are simply named
pipes) are opened when the first
READ or WRITE
transaction to that pipe operates after
PreRun. All
named pipes are closed at
PostRun. (For more
information about
PreRun and PostRun, refer to the
VEE Pro Advanced Techniques manual.) The
EXECUTE
CLOSE READ PIPE
and EXECUTE CLOSE WRITE
PIPE
transactions enable you to close pipes at any
time.
structuring
transactions
with pipes
Because of the behavior of named pipes, it is easiest to
structure transactions to transmit known or easily
parsed data blocks. For example, if you are transmitting
strings, determine the maximum length block you wish
to transmit and pad shorter strings with blanks. This
avoids the problems of trying to read more data from a
pipe than is available and of leaving unwanted data in a
pipe.
using DATA
READY
transaction
To help prevent a
READ transaction from hanging until
data is available, use a
READ IOSTATUS DATA READY
transaction in a separate
To/From Rocky Mountain
Basic
object. The transaction returns a 1 if there is at
least one byte to read, and a
0 if there are no bytes to
read. To read all the data available on the read pipe, use
a
READ ... ARRAY ID TO END:(*) transaction.