Hi,

In the example code in README.thread under Single API use

http://www.net-snmp.org/docs/README.thread.html

1) Can an snmp_pdu be cloned and sent to multiple sessions?

2)

If we are getting data in a loop, can we create SNMP PDU attach them to
snmp_session created before the loop and release memory of snmp_session and
close void * sessp after the loop? In short can the same snmp_session and
void *sessp be used for multiple PDUs? Or we have to allocate both
snmp_session and void *sessp for each PDU?

netsnmp_session *session = (netsnmp_session *) malloc
(sizeof(netsnmp_session);

snmp_sess_init(session);

void *sessp = snmp_sess_add(session, netsnmp_client, NULL, NULL);

while (data)

{

   ...create pdu

   ...Attach data to pdu

   if (0 == snmp_sess_send(sessp, pdu)) {
          snmp_sess_error(sessp, &liberr, &syserr, &errstr);
          printf("SNMP write error %s.\n", errstr);
          free(errstr);
          return 0;
   }

}


snmp_sess_close(sessp);



Best Regards,
Nishikant Deshmukh
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to