Thanks Frank, I also noticed that the address of 127.0.0.1 doesn't work, but when I changed it to 0.0.0.0 it started getting traps. I'm good to go, and looking forward to using this great library!
Thanks! On Sat, Dec 26, 2009 at 6:19 PM, Frank Fock <[email protected]> wrote: > The targetAddress variable is never used, so you do not assign > a port (and address) to the listener. Without a port and address, > SNMP4J choses all local host addresses and an arbitrary port > > 1024. If you guess (and use) that port by the trap generator, > you will receive it. > > Regards, > Frank > > On 23.12.2009 22:09, darrick wrote: > > Looking at the example in the Snmp4j java docs I tried to implement a > trap > > receiver but it is never getting executed. To ensure that the traps are > > actually being sent I am using iReasoning's MIB browser which has its own > > trap sender and trap receiver. The receiver is getting traps from both > the > > trap receiver and a xerox printer that I have setup to send traps. I > checked > > my windows box and made sure that the windows snmp services were all shut > > off. Any ideas? Below is my code: > > > > Address targetAddress = > > GenericAddress.parse("udp:127.0.0.1/162"); > > TransportMapping transport = null; > > try > > { > > transport = new DefaultUdpTransportMapping(); > > } > > catch ( IOException e1 ) > > { > > // TODO_djc Auto-generated catch block > > e1.printStackTrace(); > > } > > > > > > Snmp snmp = new Snmp(transport); > > > > CommandResponder trapPrinter = new CommandResponder() { > > public synchronized void processPdu(final CommandResponderEvent e) { > > wasHit = true; > > PDU command = e.getPDU(); > > if (command != null) { > > System.out.println(command.toString()); > > } > > } > > }; > > > > snmp.addCommandResponder(trapPrinter); > > try > > { > > transport.listen(); > > } > > catch ( IOException e1 ) > > { > > // TODO_djc Auto-generated catch block > > e1.printStackTrace(); > > } > > _______________________________________________ > > SNMP4J mailing list > > [email protected] > > http://lists.agentpp.org/mailman/listinfo/snmp4j > > -- > AGENT++ > http://www.agentpp.com > http://www.snmp4j.com > http://www.mibexplorer.com > http://www.mibdesigner.com > > _______________________________________________ > SNMP4J mailing list > [email protected] > http://lists.agentpp.org/mailman/listinfo/snmp4j > _______________________________________________ SNMP4J mailing list [email protected] http://lists.agentpp.org/mailman/listinfo/snmp4j
