Peter Minev

Peter Minev

  • NA
  • 54
  • 0

Mirror of remote object

Jan 26 2009 5:10 PM

Hi,

I have remote object derived from MarshalByRefObject. In the client I want to create local mirror object (not proxy) of the remote object, in order to speed up my application, i.e. to read values from the mirror object, not from the remote one.

I do this with this call:

thisEvent = (Event)Activator.GetObject(typeof(Event), "tcp://" + ServerAddresstextBox.Text + ":8086/Hi");

XmlSupport.readEventFromXML(screen1_openInitFileDialog.FileName, thisEvent);

bufferEvent = new Event(thisEvent);

Up to now, everything is OK. I access the bufferEvent object to read values, it is local object (not proxy to remote one). I close the client application, keep the server running, and I open the client application again. But when I connect to the remote object again, now the buffer object (i.e. the mirror object) is no more local, but instead it is proxy to the remote object and my operations are very slow (:

thisEvent = (Event)Activator.GetObject(typeof(Event), "tcp://" + ServerAddresstextBox.Text + ":8086/Hi");

bufferEvent = new Event(thisEvent); - now this call creates proxy to the remote object, instead of loca object :(

The server is configured with WellKnownObjectMode.Singleton to hold the state of the object.

Any help?

Peter