This project has moved and is read-only. For the latest updates, please go here.

[en] Could you please tell me how to work with remote MarshalByRefObject via Duplex TCP channel? (solved)

Topics: Technical Support
Sep 23, 2014 at 8:48 AM
Edited Sep 23, 2014 at 8:49 AM
If a function of a registered object returns the type of data that is serialized, then everything works fine. But if you pass an object inherited from MarshalByRefObject, an error occurs.

There is an example of problem code:
// shared project
public interface IMyServer
        IChildObject GetChildObject();

    public interface IChildObject
        string GetString();

// Implementation
public class MyServer : IMyServer
        public IChildObject GetChildObject()
            return new ChildObject();

    public class ChildObject : MarshalByRefObject, IChildObject
        public string GetString()
            return "str";

// server side
var protocol = new TcpDuplexServerProtocolSetup(Properties.Settings.Default.TcpPort, new NullAuthenticationProvider(), true);
            using (ZyanComponentHost host = new ZyanComponentHost("MyServer", protocol))
                host.RegisterComponent<IMyServer, MyServer>(ActivationType.Singleton);

                Console.WriteLine("Chat server started. Press Enter to exit.");

// client side
var protocol = new TcpDuplexClientProtocolSetup(true);
            var connection = new ZyanConnection("tcpex://localhost:9010/MyServer", protocol);
            var myServerProxy = connection.CreateProxy<IMyServer>();
            var childObjectProxy = myServerProxy.GetChildObject();
            var str = childObjectProxy.GetString();  // <- exception

Excecton details:
Unhandled Exception: System.Runtime.Remoting.RemotingException: This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.
   at System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(IMethodCallMe
ssage reqMcmMsg, Boolean useDispatchMessage, Int32 callType)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage reqMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
   at Zyan.Examples.MiniChat.Shared.IChildObject.GetString()
   at Zyan.Examples.MiniChat.Console.Program.Main(String[] args)
Sep 24, 2014 at 9:47 PM

Hmm, don't see anything wrong with your code...
Passing MarshalByRefObjects should work fine (Zyan in fact uses them internally).
Will look into it.

Thanks for submitting the issue!
Oct 17, 2014 at 9:46 PM
Hi DiverDW,

Sorry for being quiet for a while! Just found a way to reproduce your issue.
This problem existed in Zyan version 2.5, but it has been already fixed, see this work item:

Please download the latest Zyan sources from SVN and build the solution.
The bugfix will be included in the upcoming release 2.6.
Sorry for inconvenience!

Regards, Alexey.
Marked as answer by yallie on 10/17/2014 at 4:06 PM