[SNMP4J] snmp()
Frank Fock
fock at agentpp.com
Sun Nov 9 18:56:05 CET 2008
Hello Anthony,
Like the JavaDoc for Snmp explains it:
If using the default constructor you need
to add a MessageDispatcher and the security
models yourself.
Best regards,
Frank
Anthony Alessi wrote:
> Hello all,
>
> I am new to SNMP4J programming. I am trying to initialize Snmp
> with the basic constructor. I can get it to work if I use the constructor
> and specify the Transport Mapping. Searching though the Mailing List Archive
> I came across a message from Frank:
>
> Hi Afnan,
>
> When using the Snmp() constructor you need to manually add the
> MessageProcessingModels (MPV1,MPV2c, or MPv3) and
> SecurityModels (USM) you want to use.
>
> The current JavaDoc is wrong and will be fixed for the next release.
>
> Best regards,
> Frank
>
>
> My Problem is that I can't see how to accomplish this in the JavaDocs.
> Please help. I have included the relevant parts of my code below.
>
>
>
> Address targetAddress = GenericAddress.parse("udp:"
> + addr + "/161");
>
>
>
> TransportMapping transport = new
> DefaultUdpTransportMapping();
>
> snmp = new Snmp(); //This works when:
> snmp = new Snmp(transport)
>
> snmp.addTransportMapping(transport);
>
> transport.listen();
>
>
>
> // setting up target
>
> CommunityTarget target = new CommunityTarget();
>
> target.setCommunity(new OctetString(com));
>
> target.setAddress(targetAddress);
>
> target.setRetries(2);
>
> target.setTimeout(1500);
>
> target.setVersion(SnmpConstants.version1);
>
>
>
> // creating PDU
>
> PDU_Accumulator requestPDU = new PDU_Accumulator();
>
> PDU responsePDU = new PDU();
>
> requestPDU.setType(PDU.GET);
>
>
>
> requestPDU.addNetworkUtilizationRequest(index);
>
>
>
> ResponseEvent event = snmp.send(requestPDU, target,
> transport);
>
>
>
> Thanks,
>
> Anthony Joseph Alessi
>
>
>
>
>
> _______________________________________________
> 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