amarquee.library/QGetAndSubscribeOp amarquee.library/QGetAndSubscribeOp
NAME
QGetAndSubscribeOp - Get the given data items, and start watching them.
SYNOPSIS
#include
LONG QGetAndSubscribeOp(struct QSession * session, char * wildpath, LONG maxBytes)
NOTE
This function required v46 of amarquee.library, and v46
of AMarqueed.
FUNCTION
This function is a combination of the QGetOp() and QSubscribeOp()
methods. Calling this function is the same as calling QGetOp()
followed by QSubscribeOp(), with the same arguments. This function
is handy when you need to know the current state of some data
and also want to be notified when the data changes.
The advantages of this function over calling QGetOp() and
QSubscribeOp() separately are twofold: first off, you only
have to remember the ID number of one operation, rather than
two; and secondly, it eliminates the possibility of race
conditions between the two operations.
INPUTS
session - The session to send the get&subscribe op to.
wildpath - The regular path name indicating which items you are
interested in. Regular expressions are allowed.
maxBytes - Works similarly to the maxBytes argument in QGetOp.
If the data portion of entries sent to you is longer
than "maxBytes", it will be truncated to maxBytes
bytes. Set this to -1 to allow any size data to be
sent.
RESULTS
Returns the assigned ID number of the get&subscribe operation on
success, or 0 on failure. Any server-side errors will be sent
asynchronously as QMessages. Data QMessages resulting from this
command may continue to be sent indefinitely, or until you cancel
your subscription with QClearSubscriptionOp.
EXAMPLE
LONG transID;
/* Tells AMarqueed to send us the current value of the item
"data" in "ExampleProgram"'s home directory, and also to
send us a message whenever ExampleProgram changes the value
of "data". */
if (transID = QGetAndSubscribeOp(session, "/#?/ExampleProgram/data", -1))
printf("GetAndSubscribe op succeeded, was given id #%li\n",transID);
else
printf("GetAndSubscribe op failed. (no memory?)\n");
AREXX NOTES
In ARexx, the third argument is optional. If it is not specified,
it defaults to -1 (e.g. no size limit).
AREXX EXAMPLE
transID = QGetAndSubscribeOp(session, '/#?/ExampleProgram/data')
if (transID = 0) then say "Oops, operation failed"
SEE ALSO
QGo, QGetOp, QSubscribeOp, QClearSubscriptionOp
Converted on 24 Mar 2002 with RexxDoesAmigaGuide2HTML 2.1e(private) by Michael Ranner.