Giving object thru InterprocessConnection


#1

Hi.
Starting to get interested in InterprocessConnection and sockets.
An idea I didn’t even try yet, so probably is a stupid question.
But, can I send objects thru InterprocessConnection , or really only messages ?
As we’re talking about memory blocks…
Thanks.


#2

Well, if both apps are running exactly the same binary, then you could pass simple POD objects, but there are a lot of gotchas, I certainly wouldn’t recommend it!


#3

I understand it might be very limited and risky.
Basically I’m thinking of classes that would simply handle an XmlElement, some arrays, files, and a few methods to exchange and verify data sends/receives.
Nothing starting threads or opening sockets for example.

Thanks for the reply !


#4

Are you thinking of sending actual ‘code’? Almost certainly not. Sending data to duplicate the state of an object on a remote machine: sure, no problem. XML is a good choice - convert all the data to describe your object to XML, send that. At the remote end, write code to create a new object and set it up using the data.

If you really do mean code… the only two sensible approaches would be:

json or similar - a basic expression to do one operation on some data,

or:

scripting, using a language such as lua. Send your script on the connection, then run it using a remote machine (scripting setup) at the other end.

Bruce