[AGENT++] Error adding a MIB leaf

Juan Francisco Navarro jfnp090274 at yahoo.es
Thu Oct 13 17:20:58 CEST 2005


Hi,

I'm new to Agent++, and I'm getting an error when I try to run the code shown below. The error occurs when I try to execute the line mib.add(new sysGroup(sysDescr.get_printable(), "1.3.6.1.4.1.4976", 10)); 

at this moment, the program crashes, with an "Unhandled Exception... Access violation writing...". I'm using VC++ 7.1 and the release static version of the snmp++ and agent++ libraries.

If I use the debug static version, I get another error, in line Snmpx snmp(status, 161); The error is again an "unhandled exception... Access violation wrting...", and the call stacks shows that the error seems to be at AgentLogImpl::operator +=.

Could anyone help me?

BR,

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])

{

// TODO: code your application's behavior here.

int status;

OctetStr sysDescr("CysSnmpAgent");

Mib mib;

RequestList reqList;



Snmp::socket_startup();

Snmpx snmp(status, 161);

if (status != SNMP_CLASS_SUCCESS) {

printf(snmp.error_msg(status));

exit(1);

}

reqList.set_snmp(&snmp);

mib.set_request_list(&reqList);


mib.add(new sysGroup(sysDescr.get_printable(), "1.3.6.1.4.1.4976", 10));

mib.add(new snmpGroup());

mib.add(new Temperature());


Request *req;

for(;;) {

req = reqList.receive(120);

if (req)

mib.process_request(req);

}

Snmp::socket_cleanup();

}

return nRetCode;

}



More information about the AGENTPP mailing list