Use of snmp_select_info()
Vincent Bernat <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi! I have a program based on a select() loop. I have integrated netsnmp into this loop. The original code is: select(nfds + 1, &rfds, NULL, NULL, &tv); The new code is: snmpblock = 0; memcpy(&snmptv, &tv, sizeof(struct timeval)); snmp_select_info(&nfds, &rfds, &snmptv, &snmpblock); if (snmpblock == 0) memcpy(&tv, &snmptv, sizeof(struct timeval)); select(nfds + 1, &rfds, NULL, NULL, &tv); First, if I understand correctly the manual page, I should set snmpblock to 0 to let snmp_select_info() consider "snmptv" value. Then, after snmp_select_info(), I need to check that snmpblock is still 0 to consider that the new value of snmptv is correct. Otherwise, I should consider it as NULL (and in my case, I use the previous value instead). Do I use correctly snmp_select_info()? Am I right to assert that if snmpblock is still 0 after snmp_select_info, "snmptv" is less or equal to the value of "tv"? I ask this question because on some unknown and rare condition, select() seems to hang. If you need to look at the real code, here it is: http://cgit.luffy.cx/lldpd/tree/src/lldpd.c?id=630b4134e8ca84f205e12d8690182a216254f403#n547 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users