Re: Mixing sync and async calls?

This is a discussion on Re: Mixing sync and async calls? within the SNMP Coders forums, part of the Networking and Network Related category; On Wed, Feb 14, 2007 at 01:17:05PM -0800, 7715@blargh.com wrote: > I'm writing a program ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-14-2007
Steve Friedl
 
Posts: n/a
Default Re: Mixing sync and async calls?

On Wed, Feb 14, 2007 at 01:17:05PM -0800, 7715@blargh.com wrote:
> I'm writing a program that, in essence, polls a number of devices
> simultaneously. They're slow to respond individually, and I have a lot to
> go through - doing them sequentially would take forever. I set up a
> callback function and send my requests off via snmp_send(), use snmp_wait()
> and everything is happy.
>
> However, in one case, while processing the async response in my callback
> function, I need to fetch a different piece of information before I can
> finish with processing. I make an entire new SNMP session, and send it off
> to snmp_synch_response.
>
> Unfortuantely, snmp_synch_response never returns - it looks like it sends
> the request off and uses snmp_wait(), but that unfortuantely just goes back
> to processing the async responses. This eventually just blows over the
> stack (hitting bt in gdb and getting 500+ stack frames is not a pleasant
> experience).
>
> Right now, I'm looking at having to just call the command-line snmpget to do
> what I want (it would be rather difficult to get this fed back into the
> async processing) - is that the only solution to this? Is there a way to
> get NET-SNMP to ignore the async requests while its supposed to be
> processing the single sync request?


The proper way to handle this is to have an object per device, and work
with a *list* of things you need to poll. You'll kick the process for
one request by transacting the first OID, and during the callback process
mark that one as finished.

Then, in the main loop having finished the first OID, you'll kick off the
second.

Steve

---
Stephen J Friedl | Security Consultant | UNIX Wizard | +1 714 544-6561
www.unixwiz.net | Tustin, Calif. USA | Microsoft MVP | steve@unixwiz.net

-------------------------------------------------------------------------
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
http://www.techsay.com/default.php?p...rge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:03 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0