ReceiveTrap.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:1k
- /*$Id: ReceiveTrap.java,v 1.1 2002/06/15 14:41:18 ram Exp $*/
- /*
- * @(#)ReceiveTrap.java
- * Copyright (c) 1996-2001 AdventNet, Inc. 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 AdventNetSNMP 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 .......");
-
- }
- }