Using Matlab desktop with .NET remoting

2 views (last 30 days)
Mike Daneman
Mike Daneman on 12 Jan 2019
Edited: Mike Daneman on 25 Jan 2019
Hello,
I'm having an issue trying to use Matlab with .NET remoting. I have a (non-matlab) .NET module that starts a remoting server. I have a separate DLL module that defines a class (ObjectGetter) with a function (GetProxy) that connects to the remoting server and returns the retrieved remote object as an .NET Interface (IMatRemoting). I have a 3rd DLL modules that defines the interface used by the remote object.
The remote server is running.
In Matlab desktop, I do the following:
NET.addAssembly('path to ObjectGetter class DLL');
NET.addAssembly('path to Interface DLL');
getter = ObjectGetterNameSpace.ObjectGetter;
proxy = getter.GetProxy();
None of this gives me any errors, but "proxy" is returned as a "MarshaByRefObject" instead of an "IMatRemoting" object. Therefore, I cannot call any methods on the remote object (since MarshalByRefObject doesn't have any of those methods). The "GetProxy" function return type is "IMatRemoting", so I'm not sure why the returned objects is being stored as MarshalByRefObject.
When I do the same thing using WCF, the returned object IS "IMatRemoting" and I CAN call its methods and get valid results. However, due to some limitations of WCF, I cannot use it and have to use Remoting.
The definition of "GetProxy" is below. I would really appreciate you help on this.
public IMatRemoting.IMatRemoting GetProxy()
{
IpcChannel ipcCh = new IpcChannel("myClient");
ChannelServices.RegisterChannel(ipcCh, false);
return (IMatRemoting.IMatRemoting)Activator.GetObject(typeof(IMatRemoting.IMatRemoting), "ipc://MatRemotingServer/MatRemoteObject");
}

Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!