當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。