/*$Id: ReceiveTrap.java,v 1.1 2002/06/15 14:41:18 ram Exp $*/ /* * @(#)ReceiveTrap.java * Copyright (c) 2012 ZOHO Corp. All Rights Reserved. * Please read the associated COPYRIGHTS file for more details. */ /** * This is an example program to explain how to write an application * to changeto receive traps using * com.adventnet.snmp.beans package of WebNMS SNMP API. * */ import com.adventnet.snmp.beans.*; public class ReceiveTrap implements TrapListener{ public static void main(String args[]) { // instantiate SNMP Trap Receiver bean SnmpTrapReceiver trapreceiver = new SnmpTrapReceiver(); // set the port in which the trap is received trapreceiver.setPort(162); //register the listener for trap events trapreceiver.addTrapListener(this); System.out.println("Waiting to receive traps ......."); } }