Question

Using SNMP4J, I want to set the time in a switch using the switch vendor's proprietary OID for the current time. Performing a MIB walk on the switch (as well as sniffing the SNMP traffic while setting the time with the switch's web interface) revealed the type of the parameter to be timeticks-value(3). I thought this meant i should use the TimeTicks variable type in SNMP4J. My problem is I simply cannot assign a TimeTicks object a value once created.

One of the TimeTicks constructors takes in a long argument; this constructor is not documented(!) and throws an exception because the argument is not an UnsignedInteger32 type. There is also a fromMilliseconds(long) method, which does the exact same thing: an IllegalArgumentException is thrown because the argument is not an UnsignedInteger32 type.

My question is, is it possible to set a TimeTicks value with SNMP4J?

Was it helpful?

Solution

I thought this was a type problem, but it turned out that my problem was caused by using a long value that was out of unsigned int range; it works with values greater than 0 and below 4294967296.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top