Python asyncore.dispatcher_with_send() Examples

The following are 24 code examples of asyncore.dispatcher_with_send(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module asyncore , or try the search function .
Example #1
Source File: test_ssl.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #2
Source File: test_ssl.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #3
Source File: test_ssl.py    From android_universal with MIT License 5 votes vote down vote up
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() 
Example #4
Source File: test_ssl.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #5
Source File: wifi.py    From pyOpenBCI with MIT License 5 votes vote down vote up
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]) 
Example #6
Source File: client.py    From snmpfwd with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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)) 
Example #7
Source File: server.py    From snmpfwd with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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,)) 
Example #8
Source File: __async_core_server.py    From karlooper with MIT License 5 votes vote down vote up
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) 
Example #9
Source File: mtunnel.py    From markovobfuscate with MIT License 5 votes vote down vote up
def __init__(self, markov, sock, oSock):
            self.markov = markov
            asyncore.dispatcher_with_send.__init__(self, oSock)
            self.client = sock 
Example #10
Source File: mtunnel.py    From markovobfuscate with MIT License 5 votes vote down vote up
def __init__(self, markov, sock):
            self.read_buffer = ''
            self.markov = markov
            #self.msock = MTunnelServer.ToRemoteServer(markov, self, msock)
            self.msock = None
            self.state = 0
            asyncore.dispatcher_with_send.__init__(self, sock)
            self.state_lock = threading.RLock() 
Example #11
Source File: mtunnel.py    From markovobfuscate with MIT License 5 votes vote down vote up
def __init__(self, markov, sock, oSock):
            self.read_buffer = ''
            self.markov = markov
            asyncore.dispatcher_with_send.__init__(self, oSock)
            self.client = sock 
Example #12
Source File: mtunnel.py    From markovobfuscate with MIT License 5 votes vote down vote up
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) 
Example #13
Source File: mtunnel.py    From MarkovObfuscate with MIT License 5 votes vote down vote up
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) 
Example #14
Source File: test_ssl.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 
Example #15
Source File: test_ssl.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
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() 
Example #16
Source File: test_ssl.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #17
Source File: wifi.py    From OpenBCI_Python with MIT License 5 votes vote down vote up
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]) 
Example #18
Source File: test_ssl.py    From oss-ftp with MIT License 5 votes vote down vote up
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() 
Example #19
Source File: modbus.py    From lewis with GNU General Public License v3.0 5 votes vote down vote up
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()) 
Example #20
Source File: test_ssl.py    From BinderFilter with MIT License 5 votes vote down vote up
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 
Example #21
Source File: test_ssl.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
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() 
Example #22
Source File: mtunnel.py    From MarkovObfuscate with MIT License 5 votes vote down vote up
def __init__(self, markov, sock, oSock):
            self.markov = markov
            asyncore.dispatcher_with_send.__init__(self, oSock)
            self.client = sock 
Example #23
Source File: mtunnel.py    From MarkovObfuscate with MIT License 5 votes vote down vote up
def __init__(self, markov, sock):
            self.read_buffer = ''
            self.markov = markov
            #self.msock = MTunnelServer.ToRemoteServer(markov, self, msock)
            self.msock = None
            self.state = 0
            asyncore.dispatcher_with_send.__init__(self, sock)
            self.state_lock = threading.RLock() 
Example #24
Source File: mtunnel.py    From MarkovObfuscate with MIT License 5 votes vote down vote up
def __init__(self, markov, sock, oSock):
            self.read_buffer = ''
            self.markov = markov
            asyncore.dispatcher_with_send.__init__(self, oSock)
            self.client = sock