[SNMP4J] Acknowledgements of informs not retrieved
Frank Fock
fock at agentpp.com
Tue Dec 20 17:16:40 CET 2011
Hi,
You can find the answer in the FAQ.
On sender site you forgot to call snmp.listen();
Without listening for incoming messages you cannot
receive them.
Best regards,
Frank
Am 20.12.2011 16:22, schrieb George Vasilakis:
> 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
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax: +49 7024 8688231
More information about the SNMP4J
mailing list