[SNMP4J] snmptrap informations
Tejo Vamsi Prayaga
tejovamsi at yahoo.com
Tue Apr 5 18:34:24 CEST 2005
Hi abdel,
If you indeed received a V1 notification, then you can safely type cast the PDU returned from getPDU() method and start invoking methods of PDUv1. The stack in fact creates an instance of PDUv1 behind the scenes, if it recives a V1 notification.
Here is a sample code which illustrates this.
CommandResponder trapPrinter = new CommandResponder() {
public synchronized void processPdu(CommandResponderEvent e) {
PDU command = e.getPDU();
if (command != null) {
System.out.println(command.toString());
System.out.println(command.get(0)); //when I add this, it posts me an error
// true if any v1 PDU is received
if (command instanceof PDUv1) {
PDUv1 pduv1 = (PDUv1)command;
System.out.println(pduv1.getGenericTrap());
}
}
}
};
HTH
Regards
Tejo
abdel <boutz1 at caramail.com> wrote:
To be clearer my question is, how get an instance of the class PDUv1 starting from the method getPDU() of the class CommandResponderEvent .
because I receives PDUv1 trap and I must use the methods of this class.
thank's
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the SNMP4J
mailing list