[SNMP4J] I loose the response PDU with asynchronous send method

Rodolfo Josÿffffe9 Castellanos Jaimes rodolfojcj at yahoo.com
Fri Mar 11 10:06:15 CET 2005


Hi friends, 

When I say "I think the timeout shouldn't has
influence because the tests are in the same machine
and there shouldn't be delay between the request and
the response.", that I mean is that the response and
the request are processed in the same computer (my
desktop computer). The "manager" and the "agent" are
the same: localhost.

Bye,
Rodolfo José Castellanos Jaimes.

 --- Rodolfo Josÿffffe9 Castellanos Jaimes
<rodolfojcj at yahoo.com> escribió: 
> Hi Frank, thanks for your answer.
> 
> By default I have a timeout of 1000 micro seconds.
> I've tested increasing this time and the behavior is
> the same. For example I've set the timeout to 5000
> micro seconds. I think the timeout shouldn't has
> influence because the tests are in the same machine
> and there shouldn't be delay between the request and
> the response.
> 
> I've just changed the asynchronous "send" method by
> its equivalent synchronous one. And here the
> behavior
> is correct: I always get the response.
> 
> Now, I'm doing this:
> ////
> ...
> ...
> ...
>   PDU responsePDU = null;
>   ResponseEvent responseEvent = null;
>   responseEvent = snmp.send( requestPDU, target );
>   if ( responseEvent != null )
>     responsePDU = responseEvent.getResponse();
>   snmp.close();
>   // then, I process the response to show the
> output...
> ...
> ...
> ...
> ///
> 
> And the output is like this:
> 
> ///////////// *) Always successful for me !!!
> 
> [rodolfojcj at gandalf testPrograms]$ java -cp
> .:lib/SNMP4J.jar:lib/log4j-1.2.7.jar 
> ProgramWithSnmp4J
> Se ha creado la vista
> 0 [main] DEBUG org.snmp4j.security.Salt  -
> Initialized
> Salt to c545429a6909c503.
> 75 [main] DEBUG
> org.snmp4j.transport.DefaultUdpTransportMapping  -
> Sending message to 150.187.64.101/161 with length
> 43:
>
30:29:02:01:00:04:06:70:75:62:6c:69:63:a0:1c:02:04:67:fe:98:a0:02:01:00:02:01:00:30:0e:30:0c:06:08:2b:06:01:02:01:01:03:00:05:00
> 81 [main] DEBUG org.snmp4j.Snmp  - New pending
> request
> with handle PduHandle[1744738464]
> 180 [Thread-1] INFO
> org.snmp4j.transport.DefaultUdpTransportMapping  -
> UDP
> receive buffer size for socket 150.187.64.101/0 is
> set
> to: 32767
> 181 [Thread-1] DEBUG
> org.snmp4j.transport.DefaultUdpTransportMapping  -
> Received message from
> gandalf.unet.edu.ve/150.187.64.101/161 with length
> 46:
>
30:2c:02:01:00:04:06:70:75:62:6c:69:63:a2:1f:02:04:67:fe:98:a0:02:01:00:02:01:00:30:11:30:0f:06:08:2b:06:01:02:01:01:03:00:43:03:03:d2:c9
> 278 [Thread-1] DEBUG org.snmp4j.Snmp  - Removing
> pending request with handle PduHandle[1744738464]
> Se ha recibido el evento pduArrived...
>  
>  
>         Error Index = 0
>         Error Status = 0
>         Error Status Text = Success
>         PDU Type Number = -94
>         PDU Type String = RESPONSE
>         OID = Value ...
>                  There are 1 responsed variables
>                 1.3.6.1.2.1.1.3.0 = 0:41:45.69
> /////////////
> 
> I will be more tests to see if I can catch what is
> hapenning, and thanks again by the answers.
> 
> Bye,
> Rodolfo José Castellanos Jaimes
> 
>  --- Frank Fock <fock at agentpp.com> escribió: 
> > Hi Rodolfo,
> > 
> > Have you tried to increase the timeout value for
> > your target yet?
> > It seems that the agent's response is received too
> > late (the timeout
> > has already removed the corresponding request
> > object).
> > 
> > Best regards,
> > Frank
> > 
> > Rodolfo Josÿffffe9 Castellanos Jaimes wrote:
> > 
> > >Hi friends.
> > >
> > >I have the following code to send a GET PDU to
> > >localhost. I'm testing with asynchronous methods.
> > >
> > >This is the code of the method that I use to send
> > the
> > >PDU (I'm guiding me by the snmp4j_tool console
> app.
> > >source code and some others that I've written):
> > >
> > >///////////
> > >
> > >public void send()
> > >{
> > >  try
> > >  {
> > >    this.target = createTarget();
> > >    target.setVersion( snmpVersion );
> > >    target.setAddress( targetAddress );
> > >    target.setRetries( maxRetries );
> > >    target.setTimeout( timeout );
> > >		
> > >    Snmp snmp = createSnmpSession();
> > >    snmp.listen();
> > >		
> > >    // create the request PDU
> > >    PDU requestPDU = createPDU( target );
> > >
> > >    if ( requestPDU.getType() == PDU.GETBULK )
> > >    {		
> > >    }
> > >    for ( int i=0; i <
> > variableBindingsVector.size();
> > >i++)
> > >    {
> > >      // add the variables that will be requested
> > >      requestPDU.add( variableBindingsVector.get(
> i
> > )
> > >);
> > >    }
> > >    // the listener that will "listen" the
> response
> > >PDU
> > >    ResponseListener responseListener =
> > >createResponseListener();
> > >    // send the PDU
> > >    snmp.send(requestPDU, target , null,
> > >responseListener);
> > >  }
> > >  catch( IOException ioe )
> > >  {
> > >  }
> > >} // end method send
> > >
> > >///////////
> > >
> > >Then, I compile and run a test application that
> > >request some variables within the MIB-II System
> > group.
> > >
> > >When I run it, sometimes I get the response PDU
> > (which
> > >I process to produce some output) but sometimes I
> > get
> > >no answer. 
> > >
> > >Here I show you two samples of differents
> outputs.
> > I
> > >put the Logger Level to Level.ALL with the aim of
> > see
> > >what could be hapenning. These outputs are
> produced
> > by
> > >the same code, in the same machine, with the same
> > >packages of SNMP4J and Log4J.
> > >
> > >/////  1) Not successful for me
> > >[rodolfojcj at gandalf testPrograms]$ java -cp
> > >.:lib/SNMP4J.jar:lib/log4j-1.2.7.jar 
> > >ProgramWithSnmp4J
> > >Se ha creado la vista
> > >Se ha agregado el PduListener
> > >0 [main] DEBUG org.snmp4j.security.Salt  -
> > Initialized
> > >Salt to 1c9c18862b9d60ca.
> > >85 [Thread-1] INFO
> > >org.snmp4j.transport.DefaultUdpTransportMapping 
> -
> > UDP
> > >receive buffer size for socket 150.187.64.101/0
> is
> > set
> > >to: 32767
> > >163 [main] DEBUG
> > >org.snmp4j.transport.DefaultUdpTransportMapping 
> -
> > >Sending message to 150.187.64.101/161 with length
> > 43:
> 
=== message truncated === 

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com



More information about the SNMP4J mailing list