[SNMP4J] Broadcast snmp request with snmp4j.

Frank Fock fock at agentpp.com
Thu Jan 26 08:52:01 CET 2006


Hello Kapay,

You can wrap the mesage disptacher in a MultiThreadedMessageDispatcher.
On a multi core or HT system, this will improve the behavior. You can also
try to increase the ReceiveBufferSize.
Please let us know if this improved the situation on you Linux machine.

Thanks in advance,
Frank

he he wrote:

>  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.
>_______________________________________________
>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