# Path: pysnmp/carrier/asynsock/dispatch.py
# class AsynsockDispatcher(AbstractTransportDispatcher):
#     def __init__(self):
#         self.__sockMap = {} # use own map for MT safety
#         self.timeout = 0.5
#         AbstractTransportDispatcher.__init__(self)
# 
#     def getSocketMap(self): return self.__sockMap
#     def setSocketMap(self, sockMap=socket_map): self.__sockMap = sockMap
#     
#     def registerTransport(self, tDomain, t):
#         AbstractTransportDispatcher.registerTransport(self, tDomain, t)
#         t.registerSocket(self.__sockMap)
# 
#     def unregisterTransport(self, tDomain):
#         self.getTransport(tDomain).unregisterSocket(self.__sockMap)
#         AbstractTransportDispatcher.unregisterTransport(self, tDomain)
# 
#     def transportsAreWorking(self):
#         for transport in self.__sockMap.values():
#             if transport.writable():
#                 return 1
#         return 0
#     
#     def runDispatcher(self, timeout=0.0):
#         while self.jobsArePending() or self.transportsAreWorking():
#             poll(timeout and timeout or self.timeout, self.__sockMap)
#             self.handleTimerTick(time())
# 
# Path: pysnmp/carrier/asynsock/dgram/udp.py
# class UdpSocketTransport(DgramSocketTransport):


from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher
from pysnmp.carrier.asynsock.dgram import udp
from pyasn1.codec.ber import encoder, decoder
from pysnmp.proto import api
from time import time
                        transportAddress, name.prettyPrint(), val.prettyPrint()
                        )
                    )
            # Stop on EOM
            for oid, val in varBindTable[-1]:
                if not isinstance(val, pMod.Null):
                    break
            else:
                transportDispatcher.jobFinished(1)
                
            # Generate request for next row
            pMod.apiPDU.setVarBinds(
                reqPDU, [ (x, pMod.null) for x,y in varBindTable[-1] ]
                )
            pMod.apiPDU.setRequestID(reqPDU, pMod.getNextRequestID())
            transportDispatcher.sendMessage(
                encoder.encode(reqMsg), transportDomain, transportAddress
                )
            global startedAt
            if time() - startedAt > 3:
                raise Exception('Request timed out')
            startedAt = time()
    return wholeMsg

transportDispatcher = AsynsockDispatcher()

transportDispatcher.registerRecvCbFun(cbRecvFun)
transportDispatcher.registerTimerCbFun(cbTimerFun)

transportDispatcher.registerTransport(

# Path: pysnmp/carrier/asynsock/dispatch.py
# class AsynsockDispatcher(AbstractTransportDispatcher):
#     def __init__(self):
#         self.__sockMap = {} # use own map for MT safety
#         self.timeout = 0.5
#         AbstractTransportDispatcher.__init__(self)
# 
#     def getSocketMap(self): return self.__sockMap
#     def setSocketMap(self, sockMap=socket_map): self.__sockMap = sockMap
#     
#     def registerTransport(self, tDomain, t):
#         AbstractTransportDispatcher.registerTransport(self, tDomain, t)
#         t.registerSocket(self.__sockMap)
# 
#     def unregisterTransport(self, tDomain):
#         self.getTransport(tDomain).unregisterSocket(self.__sockMap)
#         AbstractTransportDispatcher.unregisterTransport(self, tDomain)
# 
#     def transportsAreWorking(self):
#         for transport in self.__sockMap.values():
#             if transport.writable():
#                 return 1
#         return 0
#     
#     def runDispatcher(self, timeout=0.0):
#         while self.jobsArePending() or self.transportsAreWorking():
#             poll(timeout and timeout or self.timeout, self.__sockMap)
#             self.handleTimerTick(time())
# 
# Path: pysnmp/carrier/asynsock/dgram/udp.py
# class UdpSocketTransport(DgramSocketTransport):


# Path: examples/v1arch/manager/nextgen.py
from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher
from pysnmp.carrier.asynsock.dgram import udp
from pyasn1.codec.ber import encoder, decoder
from pysnmp.proto import api
from time import time

                        transportAddress, name.prettyPrint(), val.prettyPrint()
                        )
                    )
            # Stop on EOM
            for oid, val in varBindTable[-1]:
                if not isinstance(val, pMod.Null):
                    break
            else:
                transportDispatcher.jobFinished(1)
                
            # Generate request for next row
            pMod.apiPDU.setVarBinds(
                reqPDU, [ (x, pMod.null) for x,y in varBindTable[-1] ]
                )
            pMod.apiPDU.setRequestID(reqPDU, pMod.getNextRequestID())
            transportDispatcher.sendMessage(
                encoder.encode(reqMsg), transportDomain, transportAddress
                )
            global startedAt
            if time() - startedAt > 3:
                raise Exception('Request timed out')
            startedAt = time()
    return wholeMsg

transportDispatcher = AsynsockDispatcher()

transportDispatcher.registerRecvCbFun(cbRecvFun)
transportDispatcher.registerTimerCbFun(cbTimerFun)

transportDispatcher.registerTransport(

    udp.domainName, udp.UdpSocketTransport().openClientMode()