470,624 Members | 1,952 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

Remoting Problem

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.TypeFilter Level.Full;
Hashtable props = new Hashtable();
props["port"] = Facade.RemotingParameters.PORT;

// Register Channel first
System.Runtime.Remoting.Channels.Tcp.TcpServerChan nel channel = new
System.Runtime.Remoting.Channels.Tcp.TcpServerChan nel(props,provider);
System.Runtime.Remoting.Channels.ChannelServices.R egisterChannel(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(Facad e.IServices),
this._txtServer.Text);

// Add Event Handler
this._eventRepeater = new Facade.EventRepeater();
this._eventRepeater.ListChanged += this.ListChangedEventHandler;
this._services.ListChanged += _eventRepeater.ListChangedEventHandler;

Mar 6 '06 #1
3 1390
Is it possible that your Singleton server object is expiring? Have you
looked into the InitializeLifetimeService() method of
MarshalByRefObject?

-Alan

Mar 6 '06 #2
I just pulled up some code I wrote a few years back that did what
you're trying to accomplish. I used a TcpChannel at port 0 on my client
instead of a TcpClientChannel. On my server, I had the
InitializeLifetimeService method overridden as follows:

public override object InitializeLifetimeService()
{
return null;
}

Mar 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by David Krmpotic | last post: by
5 posts views Thread by LGHummel | last post: by
9 posts views Thread by swartzbill2000 | last post: by
1 post views Thread by Thomee Wright | last post: by
reply views Thread by Kristian Reukauff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.