diff --git a/examples/v1arch/asyncio/agent/cmdrsp/implementing-scalar-mib-objects-over-ipv4-and-ipv6.py b/examples/v1arch/asyncio/agent/cmdrsp/implementing-scalar-mib-objects-over-ipv4-and-ipv6.py index 266e8aad..802e709b 100644 --- a/examples/v1arch/asyncio/agent/cmdrsp/implementing-scalar-mib-objects-over-ipv4-and-ipv6.py +++ b/examples/v1arch/asyncio/agent/cmdrsp/implementing-scalar-mib-objects-over-ipv4-and-ipv6.py @@ -160,8 +160,13 @@ def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg): transportDispatcher.jobStarted(1) try: + print("This program needs to run as root/administrator to monitor port 161.") + print("Started. Press Ctrl-C to stop") # Dispatcher will never finish as job#1 never reaches zero transportDispatcher.runDispatcher() -except: + +except KeyboardInterrupt: + print("Shutting down...") + +finally: transportDispatcher.closeDispatcher() - raise diff --git a/examples/v1arch/asyncio/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py b/examples/v1arch/asyncio/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py index 74b63dcc..ea90cc5b 100644 --- a/examples/v1arch/asyncio/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py +++ b/examples/v1arch/asyncio/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py @@ -100,8 +100,13 @@ def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg): transportDispatcher.jobStarted(1) try: + print("This program needs to run as root/administrator to monitor port 162.") + print("Started. Press Ctrl-C to stop") # Dispatcher will never finish as job#1 never reaches zero transportDispatcher.runDispatcher() +except KeyboardInterrupt: + print("Shutting down...") + finally: transportDispatcher.closeDispatcher() diff --git a/examples/v3arch/asyncio/agent/cmdrsp/multiple-snmp-engines.py b/examples/v3arch/asyncio/agent/cmdrsp/multiple-snmp-engines.py index dfbdb46e..017568d8 100644 --- a/examples/v3arch/asyncio/agent/cmdrsp/multiple-snmp-engines.py +++ b/examples/v3arch/asyncio/agent/cmdrsp/multiple-snmp-engines.py @@ -90,7 +90,12 @@ # Run I/O dispatcher which would receive queries and send responses try: + print("This program needs to run as root/administrator to monitor port 161.") + print("Started. Press Ctrl-C to stop") transportDispatcher.runDispatcher() -except: + +except KeyboardInterrupt: + print("Shutting down...") + +finally: transportDispatcher.closeDispatcher() - raise