views:

617

answers:

1

I'm setting up my remoting connection like this:

port = new Random().Next(REMOTING_PORT_MIN, REMOTING_PORT_MAX);
TcpChannel chan = new TcpChannel(port);
ChannelServices.RegisterChannel(chan, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(NotificationService), "CallOnMe.rem", WellKnownObjectMode.Singleton);

notService = new NotificationService();
notService.NotificationMessageEvent += new NotificationService.NotificationMessageEventHandler(notService_NotificationMessageEvent);

RemotingServices.Marshal(notService, "CallOnMe.rem");

But every so often the connection is lost and needs tp be re-established, how can I check to see if the connection is still open?

A: 

I don't know any method where you can check if the connection is still active. But you can implement this quite easy, by either calling periodically a dummy method on the server, or do something else with the remoting object. Then you can check for the exception, and try to reconnect.

Martin Moser