[AGENT++] Thread safety (new SNMP session in each thread)
Marcus Frenkel
marcus.frenkel at gmail.com
Wed Feb 27 16:28:00 CET 2013
Hi
I have tested SNMP++ code in a scenario where I call the function
below simultaneously in different threads:
void get(const std::string & pOid )
{
int status;
CTarget ctarget( (IpAddress) "domain.tld","public","public");
// SNMP++ community target
Vb vb( pOid.c_str() );
Pdu pdu;
/// Construct a SNMP++ SNMP Object
Snmp snmp( status);
if ( status != SNMP_CLASS_SUCCESS)
{
//....
return;
}
/// Invoke a SNMP++ Get
pdu += vb;
if ( (status = snmp.get( pdu, ctarget)) != SNMP_CLASS_SUCCESS)
{
std::string error = snmp.error_msg( status));
//...
}
else
{
pdu.get_vb( vb,0);
std::string = vb.get_printable_value();
//...
}
}
I don't get any problems so far, however I'm confused by the
discussion here:
https://groups.google.com/forum/?fromgroups=#!topic/comp.protocols.snmp/9boOuteEwY4.
In there Bret Cline claims that global queues are used by SNMP
implementation that cause segmentation fault when too many SNMP GET
requests are processed at a same time. Anybody run into similar
problems when SNMP++ is used in multi-threaded environment?
Thank you.
Marcus
More information about the AGENTPP
mailing list