def run(self): #TODO: wrap most of this in a try with logging and maybe thread shutdown on exceptions
		self.queuethread = SocketCommandThread(self)
		#self.queuethread.daemon = True
		self.queuethread.start()
		self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
		#for tcp set option to reuse
		self.sock.bind(SOCKET_UDP_LISTEN_ADDR)
		logging.info('SocketServiceUDP listening on ' + str(SOCKET_UDP_LISTEN_ADDR))
		self.sock.setblocking(0)
		while not self.stop_event.is_set():
			ready = select.select([self.sock], [], [], 1)
			if ready[0]:
				data, addr = self.sock.recvfrom(1024*16)
				self.bufferhandler(data, addr)
				
		if self.queuethread != None and self.queuethread.isAlive():
			self.queuethread.stop_event.set()
		LEDMatrixBase.finalize(self)
    def run(
        self
    ):  #TODO: wrap most of this in a try with logging and maybe thread shutdown on exceptions
        self.queuethread = SocketCommandThread(self)
        #self.queuethread.daemon = True
        self.queuethread.start()
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        #for tcp set option to reuse
        self.sock.bind(SOCKET_UDP_LISTEN_ADDR)
        logging.info('SocketServiceUDP listening on ' +
                     str(SOCKET_UDP_LISTEN_ADDR))
        self.sock.setblocking(0)
        while not self.stop_event.is_set():
            ready = select.select([self.sock], [], [], 1)
            if ready[0]:
                data, addr = self.sock.recvfrom(1024 * 16)
                self.bufferhandler(data, addr)

        if self.queuethread != None and self.queuethread.isAlive():
            self.queuethread.stop_event.set()
        LEDMatrixBase.finalize(self)
Esempio n. 3
0
 def run(self):
     self.SetMatrixFromImgBase64()
     LEDMatrixBase.finalize(self)