MIB Smithy

  1. Up to Table of Contents

Waiting for Requests

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?


is the name of session; and
is an optional unique identifier to wait for, returned by a previous call to an asynchronous request API.

If no id argument is specified, this command will wait for all pending requests to be processed, and will return only when the request queue is empty. If an id is specified, then it will return only when that request has timed out or received a response. The command returns immediately if id doesn't correspond to any pending request.


  • Nothing.


% snmplib wait [snmplib next -callback my_callback 0.0]
  1. Up to Table of Contents