[SNMP4J] receiving not snmp msgs

Александр Литвинов donlal at mail.ru
Mon Nov 7 12:14:22 CET 2011


Hello. I'm using 2.0.2 version of snmp4j. And I have a question.
I have multi-thread snmp server and it works great. 
But if incomming msg isn't in smnp format, i've got an error (server continues work). And the "processPdu" method isn't called. 
I want to know, what incoming to my server. In what way can i get incoming not snmp msg? 
It would be great if i could get it as array of bytes. 


i use following code:
========================================================
public synchronized void listen(TransportIpAddress address) throws IOException
 {
 AbstractTransportMapping transport;
 if (address instanceof TcpAddress)
 {
transport = new DefaultTcpTransportMapping((TcpAddress) address);
 }
 else
 {
 transport = new DefaultUdpTransportMapping((UdpAddress) address);
 }
 ThreadPool threadPool = ThreadPool.create("DispatcherPool", 10);
 MessageDispatcher mtDispatcher = new MultiThreadedMessageDispatcher(threadPool, new MessageDispatcherImpl());

 mtDispatcher.addMessageProcessingModel(new MPv1());
 mtDispatcher.addMessageProcessingModel(new MPv2c());
 
 SecurityProtocols.getInstance().addDefaultProtocols();
 SecurityProtocols.getInstance().addPrivacyProtocol(new Priv3DES());
 
 CommunityTarget target = new CommunityTarget();
 target.setCommunity( new OctetString("public"));
 
 Snmp snmp = new Snmp(mtDispatcher, transport);
 snmp.addCommandResponder(this);
 
 transport.listen();
 System.out.println(" Bind Success: Listening on " + address);
 try
 {
 this.wait();
 }
 catch (InterruptedException ex)
 {
 System.err.println(ex.getMessage());
 Thread.currentThread().interrupt();
 }
 }
--------------------------------------- 
public synchronized void processPdu(CommandResponderEvent cmdRespEvent)
 {
//some operations with pdu
} </p>==========================================


Best regarsds, 
Alexander.



More information about the SNMP4J mailing list