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
SnmpGet.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: SnmpGet.java,v 1.1 2002/06/15 14:40:08 ram Exp $ */
- /* SnmpGet.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 to explain how to write an application to do
- * the basic SNMP operation GET using com.adventnet.snmp.beans package of
- * AdventNetSNMP api.
- *
- * The user could run this application by giving the following usage.
- *
- * java SnmpGet hostname OID [OID]
- *
- * where
- *
- * hostname is the RemoteHost (agent).The Format is string without double qoutes/IpAddress.
- * OID is the Object Identifier. Multiple OIDs can also be given.
- * The entire OID can be given or it can be given in the form of 1.1.0.
- * If the oid is not starting with a dot (.) it will be prefixed by .1.3.6.1.2.1 .
- * So the entire OID of 1.1.0 will become .1.3.6.1.2.1.1.1.0 .
- *
- * Example usage:
- *
- * java SnmpGet adventnet 1.1.0 1.2.0 1.3.0 1.4.0
- *
- */
- import com.adventnet.snmp.beans.*;
- public class SnmpGet {
- public static void main(String args[]) {
- if( args.length < 2)
- {
- System.out.println("Usage : java SnmpGet hostname OID ");
- System.exit(0);
- }
- // Take care of getting the hostname and the OID
- String remoteHost = args[0];
- String OID = args[1];
- // Instantiate the SnmpTarget bean
- SnmpTarget target = new SnmpTarget();
- //set host and other parameters
- target.setTargetHost(remoteHost);
- String oids[] = new String [args.length - 1];
- for (int i=1; i<args.length; i++) oids[i-1] = args[i];
- target.setObjectIDList(oids);
- // do the SNMP GET operation
- String result[] = target.snmpGetList();
- // print the results
- for (int i=0;i<oids.length;i++) {
- System.out.println("OBJECT ID: "+target.getObjectID(i));
- System.out.println("Response: "+result[i]);
- }
- System.exit(0);
- }
- }