Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
SnmpTrapd.java.txt
Package: AdventNetSNMPAPI_4.zip [view]
Upload User: aonuowh
Upload Date: 2021-05-23
Package Size: 35390k
Code Size: 2k
Category:
SNMP
Development Platform:
C/C++
- /* $Id: SnmpTrapd.java,v 1.1 2002/06/15 14:40:08 ram Exp $ */
- /*
- * @(#)SnmpTrapd.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the associated COPYRIGHTS file for more details.
- */
- /**
- * This is a tutorial example program for receiving traps using
- * the com.adventnet.snmp.beans package of AdventNetSNMP api.
- *
- * The user could run this application by giving the following usage.
- *
- * java SnmpTrapd
- *
- * the application will start receiving traps in the port 8001.
- *
- *
- *
- */
- import com.adventnet.snmp.beans.*;
- public class SnmpTrapd implements TrapListener {
- // instantiate the trap receiver
- SnmpTrapReceiver trapreceiver = new SnmpTrapReceiver();
- public static void main(String args[]) {
- //instantiate this class to receive trap events
- SnmpTrapd test = new SnmpTrapd();
- test.trapreceiver.setPort(8001);
- test.trapreceiver.addTrapListener(test); //add the listener and register for the trap events
- System.out.println("Waiting to receive traps .......");
- }
- public void receivedTrap(TrapEvent trapEvent) {
- //receive traps
- System.out.println("TrapEvent received. ");
- System.out.println("Received a trap from:"+trapEvent.getRemoteHost()+ " in the port "+ trapreceiver.getPort());
- System.out.println("Community is:"+trapEvent.getCommunity());
- System.out.println("Agent Address is:"+trapEvent.getAgentAddress());
- System.out.println("Enterprise OID:"+trapEvent.getEnterprise());
- System.out.println("Trap Variable OID:"+trapEvent.getObjectID(0));
- System.out.println("Continues waiting to receive traps .......");
- }
- }