summaryrefslogtreecommitdiff
path: root/perl/SNMP/examples/async1.pl
diff options
context:
space:
mode:
Diffstat (limited to 'perl/SNMP/examples/async1.pl')
-rw-r--r--perl/SNMP/examples/async1.pl17
1 files changed, 17 insertions, 0 deletions
diff --git a/perl/SNMP/examples/async1.pl b/perl/SNMP/examples/async1.pl
new file mode 100644
index 0000000..ffd6065
--- /dev/null
+++ b/perl/SNMP/examples/async1.pl
@@ -0,0 +1,17 @@
+use SNMP;
+
+$SNMP::auto_init_mib = 0;
+
+$sess = new SNMP::Session();
+
+sub poller {
+ # VarList is undefined if TIMEOUT occured
+ if (!defined($_[1])) { die "request timed out[$_[0]->{ErrorStr}]\n"; }
+ if ($i++>100000) { die "completed 500 polls\n"; }
+ #print $_[1][0]->tag, " = ", $_[1][0]->val, "\n";
+ $_[0]->get($_[1], [\&poller, $_[0]]);
+}
+
+$sess->get([[".1.3.6.1.2.1.1.3.0"]], [\&poller, $sess]);
+
+SNMP::MainLoop();