[SNMP4J] Code question

JD Bertron jbertron at sfa.com
Thu Apr 27 20:18:01 CEST 2006


Frank, Thanks. I added the transport instead of the null value in the call
to send. It properly send from the correct address and random port but the
agent doesn't receive reports during engine discovery anymore. I guess it's
still not listening on the random port.
I can't upgrade to 1.7 yet. Any idea how to fix that ?

-----Original Message-----
From: Frank Fock [mailto:fock at agentpp.com] 
Sent: Friday, April 07, 2006 5:36 PM
To: jbertron at sfa.com
Cc: snmp4j at agentpp.org
Subject: Re: [SNMP4J] Code question

Hi,

This is a bug. I fixed a similar one some time ago,
but I must have missed this one. Thanks, for pointing
me on it.

The fix will be included in the final 1.7 version
to be released on Monday.

Best regards,
Frank

JD Bertron wrote:
> Is there a specific bug/reason why Snmp.java passes null as the transport
in
> the following send method ?
> 
> This has implication on my code because I use the same snmp session object
> to send requests and receive traps. I am properly passing a transport with
a
> 0 port so it should assign a random port but it doesn't because the
> transport is not really passed on further. I fixed my problem by passing
the
> transport from the method parameter and everything is fine, but I would
like
> to know that I'm not breaking anything. 
> 
>  
> 
> public ResponseEvent send(PDU pdu, Target target,
> 
>                             TransportMapping transport) throws IOException
{
> 
>     if (!pdu.isConfirmedPdu()) {
> 
>       sendMessage(pdu, target, null);
> 
>       return null;
> 
>     }
> 
>     SyncResponseListener syncResponse = new SyncResponseListener();
> 
>     synchronized (syncResponse) {
> 
>       synchronized (sync) {
> 
>         PduHandle handle = sendMessage(pdu, target, null);
> 
>         PendingRequest request =
> 
>             new PendingRequest(handle, syncResponse, target, pdu, target,
> 
>                                transport);
> 
>         if (logger.isDebugEnabled()) {
> 
>           logger.debug("New pending request with handle " + handle);
> 
>         }
> 
>         pendingRequests.put(handle, request);
> 
>         long delay =
> 
>             timeoutModel.getRetryTimeout(0, target.getRetries(),
> 
>                                          target.getTimeout());
> 
>         timer.schedule(request, delay);
> 
>       }
> 
>       try {
> 
>         syncResponse.wait();
> 
>       }
> 
>       catch (InterruptedException iex) {
> 
>         logger.warn(iex);
> 
>         // ignore
> 
>       }
> 
>     }
> 
>     return syncResponse.response;
> 
> }
> 
>  
> 
> J.D. Bertron.
> 
> SFA Charleston. 
> 
> 843-202-2593.
> 
>  
> 
> _______________________________________________
> 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