[SNMP4J] To use snmpv2

王吉福 wangjifu at ctsi.com.cn
Wed Jul 2 10:41:20 CEST 2008


nirmala.thangamuthu,您好!

	hi:

are you sure the pdu type is TRAP, not get or getnext?

======= 2008-07-02 16:11:51 您在来信中写道:=======

>Hi,
> 
>I am using the following code for SNMP V2. But reponse always getting as
>null.
> 
> 
>Address targetAddress = GenericAddress.parse("udp:10.116.51.125/162");
>   target.setAddress(targetAddress);
>   target.setCommunity(new OctetString("public"));
>   target.setTimeout(1000);
>   target.setVersion(SnmpConstants.version2c);
>   PDU pdu = new PDU();
>   pdu.setType(PDU.TRAP);
>   long sysUpTime = System.currentTimeMillis();
>   //pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(
>    // sysUpTime)));
>   pdu.add(new VariableBinding(new
>OID("1.3.6.1.4.1.637.69.6.1.1.1.1")));
>   TransportMapping transport = new DefaultUdpTransportMapping();
>   transport.listen();
>   Snmp snmp = new Snmp(transport);
>   ResponseEvent respEv = snmp.send(pdu,target);
>   PDU  response = respEv.getResponse();
>   System.out.println("Response"+response);
> 
>Could you please inform me what might went wrong?
> 
>Regards,
>Nirmala
>
>Please do not print this email unless it is absolutely necessary. 
>
>The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 
>
>WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 
>
>www.wipro.com
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/snmp4j
>
>__________ NOD32 3233 (20080701) Information __________
>
>This message was checked by NOD32 antivirus system.
>http://www.eset.com
>
>

= = = = = = = = = = = = = = = = = = = =
			

        致
礼!
 
				 
        王吉福
        wangjifu at ctsi.com.cn
          2008-07-02



More information about the SNMP4J mailing list