当前位置: 首页>>代码示例>>Python>>正文


Python asyncore.dispatcher_with_send方法代码示例

本文整理汇总了Python中asyncore.dispatcher_with_send方法的典型用法代码示例。如果您正苦于以下问题:Python asyncore.dispatcher_with_send方法的具体用法?Python asyncore.dispatcher_with_send怎么用?Python asyncore.dispatcher_with_send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在asyncore的用法示例。


在下文中一共展示了asyncore.dispatcher_with_send方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, markov, sock, remote_server, remote_port):
            self.markov = markov
            asyncore.dispatcher_with_send.__init__(self, sock)
            msock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            msock.connect((remote_server, remote_port))
            self.msock = LocalProxy.ToMTunnelServer(markov, self, msock) 
开发者ID:cylance,项目名称:MarkovObfuscate,代码行数:8,代码来源:mtunnel.py

示例2: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, conn, certfile):
                    self.socket = ssl.wrap_socket(conn, server_side=True,
                                                  certfile=certfile,
                                                  do_handshake_on_connect=False)
                    asyncore.dispatcher_with_send.__init__(self, self.socket)
                    self._ssl_accepting = True
                    self._do_ssl_handshake() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_ssl.py

示例3: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, conn, certfile):
                    asyncore.dispatcher_with_send.__init__(self, conn)
                    self.socket = ssl.wrap_socket(conn, server_side=True,
                                                  certfile=certfile,
                                                  do_handshake_on_connect=False)
                    self._ssl_accepting = True 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:8,代码来源:test_ssl.py

示例4: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, sock, interface, server):
        asyncore.dispatcher_with_send.__init__(self, sock=sock)
        self._datastore = ModbusDataStore(interface.di, interface.co, interface.ir, interface.hr)
        self._modbus = ModbusProtocol(self.send, self._datastore)
        self._server = server

        self._set_logging_context(interface)
        self.log.info('Client connected from %s:%s', *sock.getpeername()) 
开发者ID:ess-dmsc,项目名称:lewis,代码行数:10,代码来源:modbus.py

示例5: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, sock, callback=None, high_speed=True,
                 parser=None, daisy=False):
        asyncore.dispatcher_with_send.__init__(self, sock)

        self.callback = callback
        self.daisy = daisy
        self.high_speed = high_speed
        self.last_odd_sample = OpenBCISample()
        self.parser = parser if parser is not None else ParseRaw(
            gains=[24, 24, 24, 24, 24, 24, 24, 24]) 
开发者ID:openbci-archive,项目名称:OpenBCI_Python,代码行数:12,代码来源:wifi.py

示例6: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, async_socket, handlers, settings):
        """async echo handler based on asyncore.dispatcher_with_send

        :param async_socket: the socket object
        :param handlers: handlers mapping
        :param settings: settings config

        """
        self.logger = logging.getLogger()
        self.__handlers = handlers
        self.__settings = settings
        asyncore.dispatcher_with_send.__init__(self, sock=async_socket) 
开发者ID:karldoenitz,项目名称:karlooper,代码行数:14,代码来源:__async_core_server.py

示例7: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, sock, localEndpoint, remoteEndpoint, secret,
                 dataCbFun, ctlCbFun, ctlCbCtx):
        self.__localEndpoint = localEndpoint
        self.__remoteEndpoint = remoteEndpoint
        self.__secret = secret
        self.__dataCbFun = dataCbFun
        self.__ctlCbFun = ctlCbFun
        self.__ctlCbCtx = ctlCbCtx
        self.__pendingReqs = {}
        self.__pendingCounter = 0
        self.__input = null
        self.socket = None  # asyncore strangeness
        asyncore.dispatcher_with_send.__init__(self, sock)

        try: 
            self.socket.setsockopt(
                socket.SOL_SOCKET, socket.SO_SNDBUF, 65535
            )
            self.socket.setsockopt(
                socket.SOL_SOCKET, socket.SO_RCVBUF, 65535
            )
            self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
        except socket.error:
            raise error.SnmpfwdError('%s socket error: %s' % (self, sys.exc_info()[1]))
        else:
            log.info('%s: serving new connection...' % (self,)) 
开发者ID:etingof,项目名称:snmpfwd,代码行数:28,代码来源:server.py

示例8: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, localEndpoint, remoteEndpoint, secret, dataCbFun):
        localAf, self.__localEndpoint = localEndpoint[0], localEndpoint[1:]
        remoteAf, self.__remoteEndpoint = remoteEndpoint[0], remoteEndpoint[1:]
        self.__secret = secret
        self.__dataCbFun = dataCbFun
        self.__pendingReqs = {}
        self.__pendingCounter = 0
        self.__input = null
        self.__announcementData = null

        if localAf != remoteAf:
            raise error.SnmpfwdError('%s: mismatching address family')

        asyncore.dispatcher_with_send.__init__(self)

        try:
            self.create_socket(localAf, socket.SOCK_STREAM)
            self.socket.setsockopt(
                socket.SOL_SOCKET, socket.SO_SNDBUF, 65535
            )
            self.socket.setsockopt(
                socket.SOL_SOCKET, socket.SO_RCVBUF, 65535
            )
            self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
            self.bind(self.__localEndpoint)
            self.connect(self.__remoteEndpoint)

        except socket.error:
            raise error.SnmpfwdError('%s socket error: %s' % (self, sys.exc_info()[1]))

        log.info('%s: initiated trunk client connection from %s to %s...' % (self, localEndpoint, remoteEndpoint)) 
开发者ID:etingof,项目名称:snmpfwd,代码行数:33,代码来源:client.py

示例9: __init__

# 需要导入模块: import asyncore [as 别名]
# 或者: from asyncore import dispatcher_with_send [as 别名]
def __init__(self, conn, certfile):
                self.socket = test_wrap_socket(conn, server_side=True,
                                              certfile=certfile,
                                              do_handshake_on_connect=False)
                asyncore.dispatcher_with_send.__init__(self, self.socket)
                self._ssl_accepting = True
                self._do_ssl_handshake() 
开发者ID:bkerler,项目名称:android_universal,代码行数:9,代码来源:test_ssl.py


注:本文中的asyncore.dispatcher_with_send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。