I have seen this question in Stackoverflow.com, and I want to answer it here:
Greetings readers! So I am trying to develop a client server system.. Since I have not designed a client server system before, I thought that I would post a question and see what the experts here have to say.
Requirements: .NET 3.5 WCF minimum of 2 computers, Master and Slave.
The use case is a testing environment, where the slave runs tests at the request of the master.
Questions: I would prefer that the slaves locate and connect to the master, and then the master takes control and is the one that initiates the tests to be run. The slave also makes progress reports: new test data, unexpected events, etc.
The part that I am confused about is that if the slave initiates contact with the master, doesn’t that make him the master?
Does this mean that I need servicehosts on both slave and master so that they can initiate activity?
Most channels in WCF are basically a one-way communication, in a sense only one side (WCF Client) can initiate requests - the other side (WCF Service) cannot initiate calls, only respond to them.
There are two possible solutions to the problem presented here:
- The tester slave (WCF client) initiates the connection to the tester master (WCF service). Afterwards it polls the tester master periodically to receives a list of tests to run.
- The tester slave (as a WCF client) initiates the connection to the tester master (as a WCF service). In response, the tester master (now as a WCF client) initiates a second connection to the tester client (now as a WCF service). The tester master than sends tests requests to the tester slave.
Both architectural approaches can be implemented regardless of the channel type, MSMQ, Tcp/Ip or otherwise.