Networking questions

Hi everybody,

I have some generic questions concerning the client-server model described in the Networking section of the User’s guide. I’m just trying not to reinvent the wheel, as I’m pretty sure all these issues have been dealt with.

So, my generic scheme for the monitoring software that I am writing goes like this: (a) I have a bunch of machines (the “sources”) that generate data (the monitoring info) that I want to collect. There is another machine (the “receiver”) that acts as a server: all the sources can talk directly to it, and exchange info (send histograms, respond to subscription requests, etc). I could have ~1000 sources, all communicating with the same receiver. I’ve implemented this with ROOT’s classes: TSockets for the sources, TSocketServer for the receiver.

So far, so good. I now want to add the next layer: (b) the expert/user that wants to look at the monitoring information (the real “clients”). Let’s say I am dealing with ~50 clients. They will also talk to the same receiver (via a different port), subscribe to the histograms they are each interested in, request updated monitoring info, etc.

I was wondering if I could code this in a smart way that will allow me to use as much of the software that I’ve written (will write) for (a). The idea is the same: somebody sends monitoring info, somebody else collects it (with different levels of protections and cross-checks obviously). I guess what confuses me is that my TSocketServer of (a) has now to become TSocket for case (b). This is fine, since TSocketServer inherits from TSocket. But does this mean that the clients of case (b) have to also be of type TSocketServer?

The alternative could be that the clients are simple TSockets and the receiver keeps acting as a TSocketServer for them [at a different port compared to (a)]. But then, how do I use the same code to send info from one machine to another? via a friend class that just deals with the unpacking of a TMessage?

Hope this is enough info.