Transmission of a large dbus data structure

I use dbus to communicate two programs. One creates a large image, and then sends it another program for further processing. I pass the image as a ByteArray.

With 2000x2000 images my program works, but with 4000x4000 it crasses with:

process 2283: arguments to dbus_message_iter_append_fixed_array() were       
incorrect,assertion "n_elements <= DBUS_MAXIMUM_ARRAY_LENGTH / _dbus_type_get_alignment  
(element_type)" failed in file dbus-message.c line 2628.

I understand that this means that I am passing an array more than allowed. Is there any other way to transfer big data to dbus?

This is the code snippet I'm using:

handle = StringIO()
# hdulist contains the large data structure
hdulist.writeto(handle)
hdub = dbus.ByteArray(handle.getvalue())
# this sends the image via dbus
self.dbi.store_image(hdub)

At the other end, I have something like

def store_image(self, bindata):
    # Convert binary data back to HDUList
    handle = StringIO.StringIO(bindata)
    hdulist = pyfits.open(handle)
+5
source share
3 answers

I don't think Dbus is really the best way to send large amounts of data.

How to write the data structure to a file in / tmp and just transfer the file name between programs via dbus?

+6

D-bus 128 , /etc/dbus-1/session.conf

- , . , , , . . . http://en.wikipedia.org/wiki/Named_pipe FIFO (named pipe) Python? .

+4

One simple solution that comes to my mind right now is to split the data structure. Separate it, send each part and combine it with another program. Of course, some caution is required to make sure that you join it correctly.

-1
source

All Articles