Skip to content

Commit

Permalink
Added some more hints in examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Sep 12, 2024
1 parent 9623864 commit 20249f4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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()
9 changes: 7 additions & 2 deletions examples/v3arch/asyncio/agent/cmdrsp/multiple-snmp-engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 20249f4

Please sign in to comment.