简体   繁体   中英

Client - Server: If the clients announce their presence to the server, and then the server takes over, is it still client server, or is it P2P?

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?

I decided to answer this question in a blog post:

http://dotmad.net/blog/2009/02/the-role-ofclients-and-services-in-wcf

Client/server and master/slave are not to be confused. The Master controls actions, but the Server listens for connections.

If your Clients (slaves) are initiating all contact, all you need on the Master is something listening for these requests (webservice, etc) and a processing system.

I don't know why your question is getting down-voted, it seems okay to me :)

If I were you I might be inclined to use netMsmqBinding (I love queues!). The master could dispatch requests to the slave by putting messages on an MSMQ queue, and the slave could send status reports back to the master via MSMQ. This way the two processes can work independently, and you won't have to worry about one keeping up with the other (unless one gets totally bogged down.)

To do this, you will need a ServiceHost in both processes. The master needs to host a netMsmq service, and the slave as well. Each will also need a client binding to send messages.

This would also allow you to scale out the number of slaves (or masters) in case you want more parallel processing. (All slaves can just pull messages off the same queue).

Just a thought.

Check out DuplexContracts which should allow you to know methods that you can call upon your clients. There is also Event Handling in WCF, though it requires a bit more work than normal .NET eventing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM