SNMP++/Agent++ without pthreads
Jochen Katz
katz____agentpp.com
Mon May 7 20:13:06 CEST 2001
Hi,
> // uncomment this if you do not want pthreads
> // #define USE_NO_THREADS
>
> #ifndef USE_NO_THREADS
> [...]
> #endif // USE_NO_THREADS
> Frank, does it make sense to include something like this in the standard
> distribution?
I'm not Frank, but I like your solution.
> More generally, am I likely to run into serious trouble without
> threads? I'm not writing a manager which needs to communicate with
> various agents; just a single agent which expects to receive a request
> and to fire off the response immediately. As far as I can tell from
> brief examination of Snmpx::receive() and so on, this should work just
> fine.
Yes. No problems here.
> But, what if the agent sends an SNMPv2 Inform PDU -- where in the code
> does Agent++ handle acknowledgements, retries, etc.? Am I in danger of
> blocking here?
Yes, agent++ uses synchronous informs. So the call blocks until the
response is retrieved or until it times out.
You can use async informs by changing all calls to Snmp::inform() to the
async method. You will need to change the main loop to call
reqList->receive() with a small timeout (one or two seconds) and call
SNMPProcessPendingEvents() in this loop (either after each timeout or
only if a response is outstanding).
Best regards,
Jochen
More information about the AGENTPP
mailing list