3

How can I receive traps using C or C++ and net-snmp module. I need sample code but the examples at http://www.net-snmp.org/ use syscalls but not API methods.

k1eran
  • 4,492
  • 8
  • 50
  • 73
  • I am planning to develop an NMS Application in C/C++ in Qt environment that should send and receive snmpv2c traps using any snmp libraries. I have found some code that uses netsnmp API's for sending the traps, but could not able to find API's for receiving traps. please help me and thanks in advance – madhu babu sunkara Jul 13 '15 at 10:31

1 Answers1

0

The net-snmp site does have comprehensive coding tutorials.

Look at http://www.net-snmp.org/wiki/index.php/Tutorials#Coding_Tutorials

EDIT: Also see source code for snmptrapd as a guide for how to receive traps.

k1eran
  • 4,492
  • 8
  • 50
  • 73
  • i have read about it and i only found a tool there that could handle SNMP traps which s the snmptrapd but the snmptrapd is just a tool..im looking for a library or function calls that could be used in listening for SNMP Traps in the UDP Port 162. There is a library n Net-SNMP that is for SNMP Traps sending..but for handling and decoding SNMP Traps i still didn't find one. Thanks. – madhu babu sunkara Jul 31 '15 at 09:55
  • Added a link to snmptrapd src. – k1eran Jul 31 '15 at 10:37