| < Prev | Back to Table of Contents | Next > |
Requests sent with the -callback argument specified
are sent asynchronously. That is, the API call returns immediately
with a unique identifier for the request, rather than waiting for a
timeout or response from the agent. The callback command is invoked
when a a timeout or response is received and Tcl reaches the event in
its event loop.
Sometimes it is necessary to wait for one request to finish before
continuing with another (for example, when doing a get-next walk of
the OID tree, you don't know what OID to use in the next request
until a response is received to the previous request). If you are
using asynchronous requests, you can use the wait
command to pause a script while waiting for a pending request and
allow other events to be processed.
% snmpcmd wait ?id?
..where snmpcmd is the name of session and
id is the unique identifier returned by a
previous call to an asynchronous request API.
Nothing. If no id argument is specified, this command
will wait for all pending requests to be processed. It will return
only when the request queue is empty. If a id is
specified, then it will return only when that request has timed out
or received a response. The command returns immediately if the
id doesn't correspond to any pending request.
% snmplib wait [snmplib next -callback my_callback 0.0]
| < Prev | Back to Table of Contents | Next > |