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

Reply via email to