[SNMP4J] Acknowledgements of informs not retrieved

George Vasilakis george.vasilakis at gmail.com
Tue Dec 20 16:22:51 CET 2011


Hi all.

I am trying to send v2 informs and successfully retrieve the 
acknowledgements.
I am using the following code for the receiver and the sender respectively.

Receiver:
           threadPool = ThreadPool.create("Trap", 2);
           dispatcher = new MultiThreadedMessageDispatcher(threadPool, 
new MessageDispatcherImpl());
           listenAddress = 
GenericAddress.parse(System.getProperty("snmp4j.listenAddress", 
TRAP_LISTENER_UDP_ADDRESS));
           snmp = new Snmp(dispatcher, new DefaultUdpTransportMapping());
           snmp.addNotificationListener(listenAddress, this);
           snmp.getMessageDispatcher().addMessageProcessingModel(new 
MPv1());
           snmp.getMessageDispatcher().addMessageProcessingModel(new 
MPv2c());
           snmp.listen();

Sender:
         TransportMapping transport = new DefaultUdpTransportMapping();
         Snmp snmp = new Snmp(transport);
         CommunityTarget target = new CommunityTarget();
         target.setCommunity(this.communityString);
         target.setAddress(TRAP_LISTENER_UDP_ADDRESS);
         target.setRetries(1);
         target.setTimeout(1500);
         target.setMaxSizeRequestPDU(65535);
         target.setVersion(SnmpConstants.version2c);

            PDU pdu = new PDU();
            pdu.setType(PDU.INFORM);
            List<VariableBinding> bindings = trap.getBindings();
             sysUpTime = (System.currentTimeMillis() - this.startTime) / 10;
             pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new 
TimeTicks(sysUpTime)));
             pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, 
trapOid));

             for(VariableBinding binding : bindings) {
                 pdu.add(binding);
             }
             ResponseEvent evt = snmp.inform(pdu, target);
             if(evt == null || evt.getResponse() == null) {
                 System.err.println("Notification lost");
             }
             else {
                 System.out.println("Response: " + evt.getResponse());
             }

         snmp.close();

The informs are successfully received on the receiver but no 
acknowledgment is sent back to the sender (or at least none is 
successfully retrieved by the sender). What am I doing wrong?

Frankly, I am desperate and any help would be greatly appreciated.
Thanks in advance.

George



More information about the SNMP4J mailing list