[SNMP4J] Code question

Frank Fock fock at agentpp.com
Fri Apr 7 23:36:18 CEST 2006


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