[snmp] SnmpContext question

Birgit Arkesteijn birgit at westhawk.co.uk
Wed Aug 22 12:07:18 BST 2007


Hi Brian,


On 21/08/07 18:36, Brian Jewell wrote:
> Hi,
> 
> I'm having a little trouble understanding the use of SnmpContexts and
> SnmpContextPool's.
> 
> 1) When sending GET requests to the same host, is it correct to call "new
> SnmpContextPool()" to retrieve a context each time a PDU is to be sent?

That is correct.
See
uk.co.westhawk.examplev2c.set_one.createContext(..)


> 2) If an SnmpContext is created for receiving traps, and a trap listener is
> added with 
> 
> 	SnmpContext context = new SnmpContext(.);
> 	context.addListener(.);
> 
> 
> When I wish to stop receiving traps from a specified host, do I need to call
> removeTrapListener() using the *same* context (as I used for calling
> addListener(), or is it ok to create a *new* SnmpContext (with the same
> properties) and use it for calling removeTrapListener()?

You'll have to use the *same* context, since the listener is associated 
with that context (and that context only). *new* SnmpContext won't do 
the trick.


> 
> Thanks for your help.
> 
> --Brian

Cheers, Birgit


-- 
-- Birgit Arkesteijn, birgit at westhawk.co.uk,
-- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK
-- Company no: 1769350
-- Registered Office:
-- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK.
-- tel.: +44 (0)161 237 0660
-- <URL: http://www.westhawk.co.uk>


More information about the snmp mailing list