Using .NET remoting I have a server application which must communicate with a separate server monitor application. The server monitor should be able to see all kinds of information about the server, such as a list of clients.
I've set up a .NET remote object which the server monitor will interface to. The .NET remote object has all of the methods it needs to be able to send appropriate data because I gave it references to modules of the server through it's constructor.
I then painfully found out that I cannot give the constructor arguments since it is a .NET remote object. Then I came to the realisation that I cannot even access the object in any obvious way since I do not have a reference to the instantiation.
How do I make my remote object useful in such a way that it can access data within the server?
Many thanks!
If I understand correctly, you need access to the instance of the object that is remoted? I assume you are registering your remote object as a singleton and have something similar to the following:
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyRemoteObject), "MyRemoteObject.rem", WellKnownObjectMode.Singleton);
Instead you can register the object like this:
MyRemoteObject myRemoteObject = new MyRemoteObject();
RemotingServices.Marshal(myRemoteObject, "MyRemoteObject.rem");
This allows you access to the instance that is remoted.