Hi,
Below is the code snippet for your reference.
import com.adventnet.snmp.beans.SnmpTarget;
import com.adventnet.snmp.mibs.MibOperations;
try
{
SnmpTarget target = new SnmpTarget();
MibOperations mibOps = target.getMibOperations();
mibOps.loadMibModules("RFC1213-MIB"); // This is required as oid should be resolved.
target.setTargetHost("localhost");
target.setObjectID(".1.3.6.1.2.1.1.5.0"); //OID should be .1.3.6.1.2.1.1.5.0 ( excluding .0 , will result in null).
String result = target.snmpSet("HostName");
System.out.println(" Result " +result);
}
catch(Exception ion)
{
ion.printStackTrace();
}
For doing set operation for more than one oid, you can refer to the snmpset.java located under the
AdventNet/SNMPAPI/examples/applications directory. Also refer to the README.html for more information.
If you still have issue, please send us the code snippet and also the error message you have obtained for more analysis.
Trust this helps.
Regards,
Srikrishnan.