Search code examples
c++winapisnmpsnmp-trap

Application not sending all SNMP Traps


I have a C++ application in visual studio that sends SNMP traps to a remote machine on certain conditions.Firewall is disabled in both machines.

I have used windows API SnmpSendMsg to send the traps.

The remote machine does not receive all the traps. Ex, if my application sends 6 traps, sometimes remote machine receives 4 traps, sometimes 5.

I am using "iReasoning MIB Browser" trap receiver to receive the trap. While debugging using wireshark and adding logs in my application, I found that my application sends 6 traps using SnmpSendMsg and each time status returned is 1 (SNMPAPI_SUCCESS). But, wireshark captures only 4-5 traps each time.

My assumption is, somehow windows is not sending the traps.

I am not sure how to further debug this issue.

Thanks


Solution

  • The SNMP uses UDP as transport protocol. The UDP is unreliable in the sense that:

    • UDP packets may be lost
    • UDP protocol provides no mechanism to tell if packets have been lost, or to resend them.

    I'd suggest using SNMP INFORMs (SNMPv2C or SNMPv3) instead of SNMP TRAPs. They are acknowledged.