This is a discussion on Re: synchronous versus asynchronous - SNMP ; On Tue, Nov 14, 2006 at 09:11:48PM +0100, Alef Veld wrote: > So basically if i understand correctly async is using select with > nonblocking sockets and a large set of file descriptors? I assume you > use that since ...
On Tue, Nov 14, 2006 at 09:11:48PM +0100, Alef Veld wrote:
> So basically if i understand correctly async is using select with
> nonblocking sockets and a large set of file descriptors? I assume you
> use that since you stated that net-snmp is not thread-safe. And in
> addition you just send a whole bunch of udp sendto's in a event loop?
> that's really something i would like to have. basically i want to
> write a function that does async snmp and in that same function it
> calculates the netblock it needs to snmp to by supplying a net/prefix
> as argument.
> However, i feel really stupid when looking at the net-snmp library or
> even example code. It seems bloody complicated :-). I'm now using a
> modified version of the sync demo app to use with snmpv1 (Seems to
> work for snmpv2 to?) but as stated before, it sucks up cpu bigtime if
> it finds a host who it cannot connect to.
"Bloody complicated" hits the nail on the head, though it's not impossible
to understand. My recommendation is to do it in perl first, because it's
way easier to cobble something together that way. The perl bindings are
It takes a while to really get a handle on how to use it well, and I've
been working on a generic async polling engine that does all the hard
stuff: give it a work list and tell it to go. I'm doing one of these in
C now, but I'd never have gotten the factoring right had I not started
in perl first.
Sadly, there isn't any really good prototype code out there for it,
though I may see if I can put some together. My code is part of a
larger infrastructure that won't be so easy to just pull out.
But perl's really the place to start if you can.
Stephen J Friedl | Security Consultant | UNIX Wizard | +1 714 544-6561
www.unixwiz.net | Tustin, Calif. USA | Microsoft MVP | firstname.lastname@example.org
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
Net-snmp-coders mailing list