Hi,
(sorry for the bad English)

I'am developping a C program with NET-SNMP.
This program collects SNMP data from a large number of targets.

There are two designs:
    1) synchronous and multi-threads
        one thread do a sysnchronous collection from one target
        demo: 
http://net-snmp.sourceforge.net/wiki/index.php/TUT:Simple_Async_Application
    2) asynchronous
        use asynchronous send function like the demo on the website
Which one is better? (stable, faster ...)
Or any other better design?

Then, some problem about asynchronous send function:
    1) I know there is a call-back function.
        Does the call-back function run multi-instances. (like multi-threads)
    2) When will the call-back function run?
        After snmp_read() ?
        Or whenever a response is received? (even before the second snmp_send())
    3) I don't quite understand the code below. (these code comes from the demo)
             >/* loop while any active hosts */
             >  while (active_hosts) {
             >    int fds = 0, block = 1;
             >    fd_set fdset;
             >    struct timeval timeout;
             >
             >    FD_ZERO(&fdset);
             >    snmp_select_info(&fds, &fdset, &timeout, &block);
             >    fds = select(fds, &fdset, NULL, NULL, block ? NULL :
&timeout);
             >    if (fds < 0) {
             >        perror("select failed");
             >        exit(1);
             >    }
             >    if (fds)
             >        snmp_read(&fdset);
             >    else
             >        snmp_timeout();
             >  }
        Why we need this part of code? Whitout these code, will the
call-back function work?
        Will these code block themselves when no response is received?
        Or cost all CPU resource?

Thanks,
pgf
email: [EMAIL PROTECTED]

-------------------------------------------------------------------------
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?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to