Circular reference while setting up bidirectional communication line between two remote objects

Posted by mphair on Stack Overflow See other posts from Stack Overflow or by mphair
Published on 2010-05-24T19:55:37Z Indexed on 2010/05/24 20:01 UTC
Read the original article Hit count: 166

Filed under:
|
|

I'm using .Net remoting to set up a bidirectional communication line between two objects. The basic structure is as follows:

Instances of RemoteObjectA call methods on StaticObjectA.
Instances of RemoteObjectB call methods on StaticObjectB.
StaticObjectA needs to be able to call methods provided by RemoteObjectB.
StaticObjectB needs to be able to call methods provided by RemoteObjectA.

The problem with this setup is the circular reference in RemoteObjectA gets StaticObjectA gets RemoteObjectB gets StaticObjectB gets RemoteObjectA...

I implemented an interface IRemoteObjectA and IRemoteObjectB and had the remote objects inheret from their respective interfaces, but then setting up the remoting fails.

If the solution to this problem is: "don't use remoting", I can deal with that. Just wanted to make sure I wasn't missing a simple solution.

© Stack Overflow or respective owner

Related posts about c#

Related posts about remoting