def get_frame(self):

        while not "\x00" in self.incomingData:
            data = self.socket.recv(1024)
            if not data:
                raise Exception("Socket seem closed.")
            else:
                self.incomingData += data

        # Get only one frame
        split_data = self.incomingData.split('\x00', 1)

        # Save the rest for later
        self.incomingData = split_data[1]

        # Get command, headers and body
        frame_split = split_data[0].split('\n')

        command = frame_split[0]

        headers = []
        body = ""
        headerMode = True

        for x in frame_split[1:]:
            if x == '' and headerMode:  # Switch from headers to body
                headerMode = False
            elif headerMode:  # Add header to the lsit
                key, value = x.split(':', 1)
                headers.append((key, value))
            else:  # Compute the body
                body += x + '\n'

        # Remove last '\n'
        body = body[:-1]

        # Return everything
        return (command, headers, body)
Get one stomp frame
dataset/ETHPy150Open ebu/radiodns-plugit/RadioVisServer/tests.py/Main.get_frame