[SNMP4J] How to get the community of a ResponseEvent

Frank Fock fock at agentpp.com
Sun Mar 25 14:26:07 CEST 2007


Hi,

You cannot get the community from a ResponseEvent,
because that would not make any sense. You
have sent the request, so you should know the
community you used when the response arrives.
Additionally, the command responder must not
change the community in its response, too!

If you want to implement a command responder
then you will have to use the CommandResponderEvent
instead which provides security state information.

Best regards,
Frank

兼俵 麻実 wrote:
> Hi Everyone,
> 
> I have something ask to you about to get the community.
> 
> When the community of actual Agent is "private",
> if I wrote 「CommunityTarget.setCommunity(new OctetString("public"));」 in
> my application,
> the system could receive Response.
> 
> I know it isn't normal operation.
> But, my application needs implementation in this case.
> 
> Would you tell me how to get the community of incoming snmp v1/v2c 
> messages,
> on a ResponseListener?
> 
>   ResponseListener listener = new ResponseListener() {
>     public void onResponse(ResponseEvent event) {
>       ((Snmp)event.getSource()).cancel(event.getRequest(), this);
>       System.out.println("Received response PDU is: "+event.getResponse());
> 
>       //!!!!!! I'd like to get the community , here. !!!!!
> 
>     }
>   };
>   snmp.send(pdu, target, null, listener);
> 
> 
> or if you have any idea for not receiveing when the community is different,
> please let me know.
> 
> 
> thanks,
> karia
> _______________________________________________
> 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