summaryrefslogtreecommitdiff
path: root/examples/hlapi/asyncio/agent
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hlapi/asyncio/agent')
-rw-r--r--examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py3
-rw-r--r--examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py b/examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py
index 92d3e70e..94926f55 100644
--- a/examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py
@@ -27,6 +27,7 @@ from pysnmp.hlapi.asyncio import *
@asyncio.coroutine
def run():
snmpEngine = SnmpEngine()
+
errorIndication, errorStatus, errorIndex, varBinds = yield from sendNotification(
snmpEngine,
CommunityData('public', mpModel=0),
@@ -44,7 +45,7 @@ def run():
if errorIndication:
print(errorIndication)
- snmpEngine.transportDispatcher.closeDispatcher()
+ yield from unconfigureNtfOrg(snmpEngine)
asyncio.get_event_loop().run_until_complete(run())
diff --git a/examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py b/examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py
index 027d3ac6..5345e98b 100644
--- a/examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py
+++ b/examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py
@@ -56,7 +56,12 @@ def sendone(snmpEngine, hostname, notifyType):
snmpEngine = SnmpEngine()
loop = asyncio.get_event_loop()
+
+# send notifications concurrently
loop.run_until_complete(
asyncio.wait([sendone(snmpEngine, 'demo.snmplabs.com', 'trap'),
sendone(snmpEngine, 'demo.snmplabs.com', 'inform')])
)
+
+# this will cancel internal timer
+loop.run_until_complete(unconfigureNtfOrg(snmpEngine)) \ No newline at end of file