Sending blobs of data over a network

Hey all

I’m interested in trying to sync data between oF on 2 different machines.
At the moment, that’s generally an iPad and a PC (osx).
Generally what i’m trying to sync is a vector of a custom class / struct.

To start with, i’m trying with fixed length arrays.
I get the pointer to the array, and memcpy that into an unsigned char array with length


This means that I have all my data in an unsigned char array, which can be rebuilt into an array of the correct type at the other end (as long as that uchar array can be sent)

In my tests so far, there hasn’t been any issue with using this concept (of copying the data into an unsigned char array, to another computer, and back into a class array).
I’ve been testing with simple classes which have no functions and a handful of fixed length data members. My tests have been between iPhone/iPad and osx. But it might turn out that this approach isn’t reliable.

The next piece of work seems to be sending large chunks of data between devices. So I want a class where i can pass it a pointer to a large data chunk, tell it how many bytes i have, and it sends the data over tcp/udp to another computer. I’d also like both ends to know when the transfer is complete and what the current progress is. It’s likely that this class would be running on its own thread.

Finally, it’d be good to make something that could automatically sync changes between two arrays (or preferably, vectors). And it was also possible to have multiple syncs (>1 client and/or >1 vector) going simultaneously.

My main question is, has anybody already attempted something similar?
Or does anybody have any advice about this?