S
S Chapman
I have a simple remote server object that raises an event when the list
maintined by it changes. The idea is to enable the remote client to
update the GUI when the server list changes. When the I create the
server object without using remoting (i.e. just use new()) the event
fires and the client updates the UI but when I create the server object
as a remote object (using Activator.GetObject()) the event does not
fire at all. I have pasted the code below. I am pulling my hair out
trying to solve this simple problem. Any help will be much appreciated.
Thank you.
===================================================
Source Code from Remoting Host ( Console App)
===================================================
// Configure the Remoting Infrastructure
BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
Hashtable props = new Hashtable();
props["port"] = Facade.RemotingParameters.PORT;
// Register Channel first
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel channel = new
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel(props,provider);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel,false);
// Use Server Activated and Singleton as the object mode
System.Type remoteType = typeof(BusinessLayer.Services);
RemotingConfiguration.RegisterWellKnownServiceType(remoteType ,
Facade.RemotingParameters.URI,
WellKnownObjectMode.Singleton);
===================================================
Source Code from Remoting Client (System.Windows.Forms App)
===================================================
// Register a Channel for Event Handler purposes.
ChannelServices.RegisterChannel(new TcpClientChannel(), false);
// Create the remote object
this._services =
(Facade.IServices)Activator.GetObject(typeof(Facade.IServices),
this._txtServer.Text);
// Add Event Handler
this._eventRepeater = new Facade.EventRepeater();
this._eventRepeater.ListChanged += this.ListChangedEventHandler;
this._services.ListChanged += _eventRepeater.ListChangedEventHandler;
maintined by it changes. The idea is to enable the remote client to
update the GUI when the server list changes. When the I create the
server object without using remoting (i.e. just use new()) the event
fires and the client updates the UI but when I create the server object
as a remote object (using Activator.GetObject()) the event does not
fire at all. I have pasted the code below. I am pulling my hair out
trying to solve this simple problem. Any help will be much appreciated.
Thank you.
===================================================
Source Code from Remoting Host ( Console App)
===================================================
// Configure the Remoting Infrastructure
BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
Hashtable props = new Hashtable();
props["port"] = Facade.RemotingParameters.PORT;
// Register Channel first
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel channel = new
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel(props,provider);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel,false);
// Use Server Activated and Singleton as the object mode
System.Type remoteType = typeof(BusinessLayer.Services);
RemotingConfiguration.RegisterWellKnownServiceType(remoteType ,
Facade.RemotingParameters.URI,
WellKnownObjectMode.Singleton);
===================================================
Source Code from Remoting Client (System.Windows.Forms App)
===================================================
// Register a Channel for Event Handler purposes.
ChannelServices.RegisterChannel(new TcpClientChannel(), false);
// Create the remote object
this._services =
(Facade.IServices)Activator.GetObject(typeof(Facade.IServices),
this._txtServer.Text);
// Add Event Handler
this._eventRepeater = new Facade.EventRepeater();
this._eventRepeater.ListChanged += this.ListChangedEventHandler;
this._services.ListChanged += _eventRepeater.ListChangedEventHandler;