LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using objects/classes/interfaces across a network boundary?

Let's say you want a server on one PC that will talk to client "plugins" (eg. concrete modules unknown to server at compile time) and use class/object based messages. Let's say for client development, it is required to inherit from a message class/interface that was specified during server development (so the server "knows" about this class/interface).

 

Is it possible for the client/plugin to send it's child message object over TCP and function correctly on the server side without having copied any client/plugin files to the server PC? Is it correct that only parent data of such a message would be accessible to the server since I'm assuming the object only contains data and not the executable code of the class methods/accessors necessary to get/set the child class data? 

 

What about if you COULD copy files to the server PC also (basically install the plugin on both the server & client PC). Could the server then have a way to unflatten the message object and dynamically access the previously copied plugin files to have full access to the public methods and data of the child object?

 

I believe some of this is of course possible due to various plugin architecture posts but I'm not sure about this specific scenario and especially over a network.

 

I guess, what is the minimum these two applications, client & server, would have to know about each other or have in common at compile time to be able to send objects and use their data or data+methods and not have to change the server source when adding new plugin clients? 

0 Kudos
Message 1 of 3
(991 Views)

The server has to know what to do with a message.  So it will need that code.  Plugins are probably the way to go with that.  So part of your message could be what class to load to use the rest of the message.  You will also have to figure out how to format the message data.  Thinking this through, I would probably use the same format I use for my configuration files to dynamically set up my test equipment:  JSON.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(982 Views)

You might want to ask this on the Actor Framework forum, as AF is all about Classes/Objects as messages and they will have experience with this problem.

 


@DoctorAutomatic wrote:

Is it possible for the client/plugin to send it's child message object over TCP and function correctly on the server side without having copied any client/plugin files to the server PC? Is it correct that only parent data of such a message would be accessible to the server... 


No.  Assuming you are flattening the child-class object, the Server will not be able to unflatten it.  You would NOT be able to access the Parent data.

 


I guess, what is the minimum these two applications, client & server, would have to know about each other or have in common at compile time to be able to send objects and use their data or data+methods and not have to change the server source when adding new plugin clients? 


To communicate, you need to speak the same language.  If you use classes as your language, you need to both know all the classes.  The only exception would be objects that the Server does not need to do anything to (call no methods; use no data): these can be kept in flattened form.  This can come up if the server needs only to send the object somewhere else (back in reply; save to disk; forward to another client).  

0 Kudos
Message 3 of 3
(930 Views)