summaryrefslogtreecommitdiff
path: root/examples/v3arch/twisted/manager/ntfrcv
diff options
context:
space:
mode:
authorelie <elie>2013-06-01 12:15:58 +0000
committerelie <elie>2013-06-01 12:15:58 +0000
commit374652248999709006e9deb62fe2d8f3cdb6323d (patch)
treee9933e8a618a0b3d0e5b0cb2000a8184fabbef9e /examples/v3arch/twisted/manager/ntfrcv
parenta8bd7e3f06c5c84363764de284ef4e7024534969 (diff)
downloadpysnmp-374652248999709006e9deb62fe2d8f3cdb6323d.tar.gz
config.addSocketTransport() helper renamed into config.addTransport()
and improved by automatically instantiating compatible TransportDispatcher making it dispatcher-agnostic. As an additional bonus, application may not call registerTransportDispatcher() as it would be called by addTransport().
Diffstat (limited to 'examples/v3arch/twisted/manager/ntfrcv')
-rw-r--r--examples/v3arch/twisted/manager/ntfrcv/v2c-multiple-interfaces.py8
-rw-r--r--examples/v3arch/twisted/manager/ntfrcv/v3-multiple-users.py6
2 files changed, 3 insertions, 11 deletions
diff --git a/examples/v3arch/twisted/manager/ntfrcv/v2c-multiple-interfaces.py b/examples/v3arch/twisted/manager/ntfrcv/v2c-multiple-interfaces.py
index 576ee1f..f0edca7 100644
--- a/examples/v3arch/twisted/manager/ntfrcv/v2c-multiple-interfaces.py
+++ b/examples/v3arch/twisted/manager/ntfrcv/v2c-multiple-interfaces.py
@@ -18,7 +18,6 @@
#
from twisted.internet import reactor
from pysnmp.entity import engine, config
-from pysnmp.carrier.twisted import dispatch
from pysnmp.carrier.twisted.dgram import udp
from pysnmp.entity.rfc3413 import ntfrcv
@@ -28,18 +27,15 @@ snmpEngine = engine.SnmpEngine()
# Transport setup
-# Instantiate and register Twisted dispatcher at SNMP engine
-snmpEngine.registerTransportDispatcher(dispatch.TwistedDispatcher())
-
# UDP over IPv4, first listening interface/port
-config.addSocketTransport(
+config.addTransport(
snmpEngine,
udp.domainName + (1,),
udp.UdpTwistedTransport().openServerMode(('127.0.0.1', 162))
)
# UDP over IPv4, second listening interface/port
-config.addSocketTransport(
+config.addTransport(
snmpEngine,
udp.domainName + (2,),
udp.UdpTwistedTransport().openServerMode(('127.0.0.1', 2162))
diff --git a/examples/v3arch/twisted/manager/ntfrcv/v3-multiple-users.py b/examples/v3arch/twisted/manager/ntfrcv/v3-multiple-users.py
index 544eb89..6421672 100644
--- a/examples/v3arch/twisted/manager/ntfrcv/v3-multiple-users.py
+++ b/examples/v3arch/twisted/manager/ntfrcv/v3-multiple-users.py
@@ -21,7 +21,6 @@
#
from twisted.internet import reactor
from pysnmp.entity import engine, config
-from pysnmp.carrier.twisted import dispatch
from pysnmp.carrier.twisted.dgram import udp
from pysnmp.entity.rfc3413 import ntfrcv
from pysnmp.proto import rfc1902
@@ -32,11 +31,8 @@ snmpEngine = engine.SnmpEngine()
# Transport setup
-# Instantiate and register Twisted dispatcher at SNMP engine
-snmpEngine.registerTransportDispatcher(dispatch.TwistedDispatcher())
-
# UDP over IPv4
-config.addSocketTransport(
+config.addTransport(
snmpEngine,
udp.domainName,
udp.UdpTwistedTransport().openServerMode(('127.0.0.1', 162))