[SNMP4J] Need procedure to receive traps
Y Srinivas
ysrinivas at indusnetworks.com
Thu Jun 15 12:02:11 CEST 2006
Hi,
Below is the code i have written to receive traps but as soon as i run the program is not waiting for the traps what should be done as i am able to see the traps using a trace tool.
import org.snmp4j.*;
import org.snmp4j.smi.*;
import org.snmp4j.transport.*;
class MySnmp1 implements CommandResponder{
TransportMapping transport;
Snmp snmp;
public MySnmp1(){
try{
transport = new DefaultUdpTransportMapping(new UdpAddress("192.168.4.58/888"));
snmp = new Snmp(transport);
snmp.addCommandResponder(this);
System.out.println("transportBinding..");
transport.listen();
}catch(Exception e){e.printStackTrace();}
}
public synchronized void processPdu(CommandResponderEvent e) {
System.out.println("----Received Response -----");
}
public static void main(String[] args)
{
new MySnmp1();
}
}
Thanks & Regards,
Y Srinivas Reddy
Software Engineer
Indus Networks Ltd.
Road No. 10c New MLA/MP Colony,
Jubilee Hills, Hyderabad - 500 035.India
Phone: 091-040-23450488 Ext.-214
Email: ysrinivas at indusnetworks.com
More information about the SNMP4J
mailing list