The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by nmkmurty]

Hi Alan
Congratulations on writing such a good book.
You have presented the difficult subject of MultiThreading in a very
easy-to-understand prose! I learned a lot.

Anyways, here I go with my question:
1) Can System.Timers.Timer be used in a situation where the "Subscriber" of
System.Timers.Timer.Elapsed is in a different process on a different machine.

Let me tell you how I want to use this. I am writing a .Net Remoting
application where there will be a server & many clients. This server will
publish some logic that can be used by Clients resident on different machines
over the network. Server uses .Net Remoting to publish this logic over the
network.

Now in order for the clients to know that the server is alive, I want to use
System.Timers.Timer object on Server to cause "HeartBeats" that Clients can
subscribe to. In the code that I wrote, I observed that Timer object
successfully notifies (causes HeartBeat thru timer) to subscribers in server
process (same process) but not to remote Client processes that subscribed to
it.

On the contrary, I have also observed that some other event(like event
MyEventHandler myEvent) is able to notify the remote Clients successfully.

So in short the question is, does System.Timers.Timer supports .Net Remoting.

Thanks
Raja
import-bot (20211) [Avatar] Offline
#2
Re: Timer and Remoting
[Originally posted by alan]

Thanks for the kind words. A time is inherently process based. I suppose you
could have a method that's invoked when the timer fires that invokes a remoted
method call, I think that would do what you're wanting.

Hope it helps,
Alan