06-20-2006 10:44 AM
06-20-2006 02:25 PM
06-21-2006 12:52 AM
Yes,
This is what I was afraid of....
But do you know if there is a possibility to access a .NET object created in Teststand upon the SequenceContext in C# (or C++)? So I could create a reference to a .NET object in Teststand, pass the sequence context and the lookup string of the variable containing the reference to LabVIEW which call my C#-Funktion. "Arrived" in my C#-fuction, may be it is possible to retreive upon the reference the instance of the .NET object I need?
Regards,
Risotto
06-21-2006 07:52 AM
06-21-2006 10:13 AM
Well!
I am not a experimented programmer, but I tried to use .NET Remote as you tell.
I wrote an "Hello World"-example, which works.
I have now a class (SampleObject) which I load with RemoteConfiguration.RegisterWellKnownService in a dummy server (SampleServer).
Then I wrote a remote client (SampleClient) which access my remote object upon the server. But I was not successfull to use Activor.CreateInstance in the remote client I wrote (I only get a new instance of my class and not the remote object). If I use Activator.GetObject, I access upon the server to the remote object. But it is slow...
How would you use CreateInstance to access to the remote object and don't get a new instance?
Code for the server:
// Create an instance of a channel
TcpChannel channel = new TcpChannel(8080);
ChannelServices.RegisterChannel(channel);
// Register as an available service with the name HelloWorld
RemotingConfiguration.RegisterWellKnownServiceType(typeof(SampleObject), "Connection", WellKnownObjectMode.Singleton);
System.Console.WriteLine("Press the enter key to exit...");
System.Console.ReadLine();
Code for the client:
// Create a channel for communicating w/ the remote object
// Notice no port is specified on the client
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
// Create an instance of the remote object
SampleObject obj = (SampleObject) Activator.GetObject(typeof(CodeGuru.Remoting.SampleObject),"tcp://localhost:8080/Connection" );
06-21-2006 11:27 AM
06-27-2006 01:36 AM
Hi Brian,
I have now found a solution to my problem:
I wrote in .NET Remote a server which create an instance of the remote object containing my data. Then, this object is register with RemotingServices.Marshal. It allow me to have an instance of the remote object . Then I create a server object in LabVIEW and may save may data directly in the instance. With Teststand, I can then with a client access with .NET Remoting to the remote object. It is may be tricky, but it works.
I put an example here so may be it can help somebody else....
Thank you for your help!
Risotto.
06-27-2006 09:52 AM