Well this code is manger code, i mean want to write my agent that is client side code that response back to my snmp request..
and i m trying out the TestAgent code geting some exception sorting out those..... -- "Human Knowledge Belongs To World" Thanks Vm On Wed, Mar 18, 2009 at 7:35 PM, Imri Zvik <[email protected]> wrote: > Hi, > > The following code example will query an SNMP enabled device and dump the > response to STDOUT: > > Address targetAddress = > GenericAddress.parse("udp:111.111.111.111/161"); > CommunityTarget target = new CommunityTarget(); > target.setCommunity(new OctetString("community")); > target.setAddress(targetAddress); > target.setVersion(SnmpConstants.version2c); > PDU pdu = new PDU(); > pdu.add(new VariableBinding(new OID(1.2.3.4.5.6)); > pdu.setType(PDU.GET); > DefaultUdpTransportMapping udpTransport = new > DefaultUdpTransportMapping(); > udpTransport.setSocketTimeout(1000); > System.out.println("Setting up socket"); > udpTransport.listen(); > Snmp snmp = new Snmp(udpTransport); > System.out.println("Sending SNMP packet"); > ResponseEvent response = snmp.send(pdu, target); > udpTransport.close(); > if (response.getResponse() == null) { > // request timed out > System.out.println("TIMEOUT waiting for a response from: " > + response.getPeerAddress()); > } else { > System.out.println("Received response from: " + > response.getPeerAddress()); > // dump response PDU > System.out.println(response.getResponse().toString()); > } > > -----Original Message----- > From: VijayMajagaonkar [mailto:[email protected]] > Sent: Wednesday, March 18, 2009 3:57 PM > To: [email protected] > Subject: [SNMP4J] sample agent code > > hello people, > > can any one send me the sample code for agent using these API, i m > new to the agent side coding as, i worked with the > SNMP manager i m bit confused how to make use of agent api in the > client side machine, > any body help or show me the first step...... > > > -- > "Human Knowledge Belongs To World" > Thanks > Vm > _______________________________________________ > SNMP4J mailing list > [email protected] > http://lists.agentpp.org/mailman/listinfo/snmp4j > > _______________________________________________ SNMP4J mailing list [email protected] http://lists.agentpp.org/mailman/listinfo/snmp4j
