[SNMP4J] New User and Errors
Frank Fock
fock at agentpp.com
Tue Jul 3 20:34:18 CEST 2007
Hi Josiane,
This is probably the most frequently asked question
and here is the answer: Call Snmp.listen() to be
able to receive the response (before you send the
request - of course).
Best regards,
Frank
Josiane Ortolan Coelho wrote:
> Hi,
>
> I'm Josi from Brazil, sorry my english... but I have problems with
> SNMP4J. I shoud be have littles mistakes in my code, so any help is
> welcome!
>
> My equipament is a router SNMPv1(10.10.69.116) port 161 community RW
> public.
> I give walk from Mib Browse of iReasoning and it answers well.
>
> TransportMapping transport = new DefaultUdpTransportMapping(new
> UdpAddress("10.10.69.116/161"));
>
> Snmp snmp = new Snmp(transport);
> // Snmp snmp = new Snmp();
> // setting up target
> Address targetAddress =
> GenericAddress.parse("udp:10.10.69.8/161");
>
> CommunityTarget target = new CommunityTarget();
> target.setCommunity(new OctetString("public"));
> target.setAddress(targetAddress);
> target.setRetries(2);
> target.setTimeout(5000);
> target.setVersion(SnmpConstants.version1);
> // creating PDU
> PDU pdu = new PDU();
> pdu.add(new VariableBinding(new OID(".1.3.6.1.2.1.1.2")));
> pdu.setType(PDU.GETNEXT);
>
>
> PDU responsePDU = snmp.sendPDU(pdu, target); //, null,
> listener);
> if (responsePDU == null) {
> System.out.println("Request timed out");
> }
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list