[SNMP4J] PDU Trap Version

David Ishmael dishmael at opsvision.com
Fri Aug 7 18:17:09 CEST 2015


Hey all - What is the best way to determine the PDU version in a trap receiver using SNMP4J?  Here’s what I have and I think this works but I’m wondering if there’s a better way...

public synchronized void processPdu(CommandResponderEvent cmdRespEvent) {
	PDU pdu = cmdRespEvent.getPDU();
	switch(pdu.getType()) {
		case PDU.V1TRAP:
			…
			break;

		case -89: // v2c?
			…
			break;

		default:  // v3?
			…
	}
}


Thanks, Dave


More information about the SNMP4J mailing list