def run(self):
        data = _as_bytes('')
        number_of_bytes = 0
        try:
            while True:
                # I.e.: check if the remaining bytes from our last recv already contained
                # a new message.
                if number_of_bytes == 0 and data.__len__() >= 4:
                    number_of_bytes = data[
                        :4]  # first 4 bytes say the number_of_bytes of the message
                    number_of_bytes = struct.unpack("<I", number_of_bytes)[0]
                    assert number_of_bytes >= 0, 'Error: wrong message received. Shutting down connection!'
                    data = data[4:]  # The remaining is the actual data