[SNMP4J] Broadcast snmp request with snmp4j.

he he kapay666 at yahoo.com
Thu Jan 26 03:41:36 CET 2006


  Hello,
   
  What is the best method of sending snmp packet broadcast with SNMP4j to discover devices in a network?
   
  i have the following codes;
   
  ----------------
  DefaultUdpTransportMapping defaultTransport = new DefaultUdpTransportMapping();
defaultTransport.setReceiveBufferSize(65535);
TransportMapping transport = defaultTransport;
Snmp asyncsnmp = new Snmp(transport);
      
MessageDispatcher md = asyncsnmp.getMessageDispatcher();
            
md.removeCommandResponder(asyncsnmp);
md.addCommandResponder(this);
md.addCommandResponder(asyncsnmp);
      
asyncsnmp.listen();
           
PduHandle reqHandle = md.sendPdu(null, ctarget.getAddress(), ctarget.getVersion(),
     SecurityModel.SECURITY_MODEL_SNMPv1, ctarget.getCommunity().getValue(),
     SecurityLevel.NOAUTH_NOPRIV, pdu, true);
   
  // the asyncsnmp session is close by a separate timer thread on timeout.
   
  .........
   
  // then i declared the processPdu() method on this same class to receive responses.
   
  public void processPdu(CommandResponderEvent e) {
  ....
  }
   
  ------------ 
   
  My codes above work fine but i am having problem handling a large number of responses since all response packets are accumulated within a single socket. The receive buffer of the socket easily overflows after like 70+ response packets on a linux system.
   
  What is the best method of sending and handling broadcast request with a large number of responses using snmp4j? Is it possible for every broadcast response to use a new socket thereby eliminating the socket receive buffer overflow problem?
   
  i know that i can increase the maximum receive buffer size of linux by changing some /proc/sys/net/core/* files but as much as possible i would like to avoid this approach if there is a more elegant solution.
   
  Thank you.
  kapay
   


		
---------------------------------
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.


More information about the SNMP4J mailing list