def run(self):
    'connect and poll messages to queue'
    sock = None
    print(('Connecting to synchronous uhd message tcp port ' + str(self.port)))
    while self.q_quit.empty():
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.connect((self.ip_address, self.port))
            break
        except socket.error:
            print(('connecting to synchronous uhd message tcp port ' + str(self.port)))
            sock.close()
            time.sleep(0.5)
    print(('Connected to synchronous uhd message tcp port ' + str(self.port)))
    sock.settimeout(None)
    s = ''
    while self.q_quit.empty():
        try:
            while self.q_quit.empty():
                s += sock.recv(self.packet_size)
                if (len(s) >= self.packet_size):
                    break
            res_tuple = struct.unpack(self.packet_type, s[:self.packet_size])
            s = s[self.packet_size:]
            self.queue.put(res_tuple)
        except socket.timeout:
            self.stop()
            traceback.print_exc()
            pass
    sock.close()
connect and poll messages to queue
def run(self):
    
    sock = None
    print(('Connecting to synchronous uhd message tcp port ' + str(self.port)))
    while self.q_quit.empty():
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.connect((self.ip_address, self.port))
            break
        except socket.error:
            print(('connecting to synchronous uhd message tcp port ' + str(self.port)))
            sock.close()
            time.sleep(0.5)
    print(('Connected to synchronous uhd message tcp port ' + str(self.port)))
    sock.settimeout(None)
    s = 
    while self.q_quit.empty():
        try:
            while self.q_quit.empty():
                s += sock.recv(self.packet_size)
                if (len(s) >= self.packet_size):
                    break
            res_tuple = struct.unpack(self.packet_type, s[:self.packet_size])
            s = s[self.packet_size:]
            self.queue.put(res_tuple)
        except socket.timeout:
            self.stop()
            traceback.print_exc()
            pass
    sock.close()