[SNMP4J] FW: Simple Get Request

Mark Roe mroe at planethost.com
Tue May 12 22:06:24 CEST 2009


My apologies.  RTFM.  Worked like a charm.

-- 
Mark Roe
PlanetHost
http://www.planethost.com
866.661.HOST

------ Forwarded Message
From: Mark Roe <mroe at planethost.com>
Date: Tue, 12 May 2009 13:09:36 -0500
To: "snmp4j at agentpp.org" <snmp4j at agentpp.org>
Subject: [SNMP4J] Simple Get Request

Have a very simple program:

public static void main(String[] args) {
      CommunityTarget target = new CommunityTarget();
      target.setCommunity(new OctetString("w0lv3r1n3s!"));
      Address address = GenericAddress.parse("udp:10.99.3.1/161");
      target.setAddress(address);
      target.setVersion(SnmpConstants.version2c);
      target.setRetries(2);
      target.setTimeout(1000);

      PDU pdu = new PDU();
      pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.1.1"))); // sysDescr
      pdu.setType(PDU.GETNEXT);

      try {
     Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
     ResponseEvent response = snmp.send(pdu, target);
     PDU responsePDU = response.getResponse();
     Address peerAddress = response.getPeerAddress();
     System.out.print("here" + peerAddress);
     System.exit(1);

      } catch (java.io.IOException ex) {
      }

   }

However, response is always null.  I have performed packet captures and do
in fact see the response from the polled device:
NetScreen-5GT-WLAN version 5.3.0r3.0

Any idea what I may be doing wrong?
-- 
Mark Roe
PlanetHost
http://www.planethost.com
866.661.HOST

_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j

------ End of Forwarded Message





More information about the SNMP4J mailing list