.NET Remoting question
-
I'm new to remoting and not very articulate so bear with me here. I have an object that needs to be queried by a remote client but it inherits from some other class already.
public MyClass : SomeBaseClass { public string GetName { return "name"; } }
So I made a remoting object like so
public class RemotingObject : MarshalByRefObject { private MyClass c; public RemotingObject( ) { } public setClass( MyClass start ) { c = start; } public string GetName( ) { return c.GetName( ); } }
and a server like so
public class RemotingServer { public RemotingServer() { TcpChannel channel = new TcpChannel( 8080 ); ChannelServices.RegisterChannel( channel ); RemotingConfiguration.RegisterWellKnownServiceType( typeof( RemotingObject ), "RemotingObject", WellKnownObjectMode.Singleton ); } }
My question is that how can I pass a MyClass object to the remotable object after it is created? Is is possible to pass it in the constructor of the remotable object? Thanks.
-
I'm new to remoting and not very articulate so bear with me here. I have an object that needs to be queried by a remote client but it inherits from some other class already.
public MyClass : SomeBaseClass { public string GetName { return "name"; } }
So I made a remoting object like so
public class RemotingObject : MarshalByRefObject { private MyClass c; public RemotingObject( ) { } public setClass( MyClass start ) { c = start; } public string GetName( ) { return c.GetName( ); } }
and a server like so
public class RemotingServer { public RemotingServer() { TcpChannel channel = new TcpChannel( 8080 ); ChannelServices.RegisterChannel( channel ); RemotingConfiguration.RegisterWellKnownServiceType( typeof( RemotingObject ), "RemotingObject", WellKnownObjectMode.Singleton ); } }
My question is that how can I pass a MyClass object to the remotable object after it is created? Is is possible to pass it in the constructor of the remotable object? Thanks.
A remote object is like another object, you can indeed pass it as a constructor parameter. Regards Senthil _____________________________ My Blog | My Articles | WinMacro