For example I have a server [c#] and 4 clients. When the first client sends a request to the server I want to push a notification to the other 3 clients that they should send a request to the server with some required data. After I receive requests from all clients I want to send the same response to all of them.

What is the best way/pattern to implement something like this?

  • The client can open a connection to server when they start, and leave it open awaiting the update. This connection is relatively cheep. Though most servers drop connections that are open to long, to stop problems of running out of connections, because of clients disappearing without closing connection, keep-alives are used to mitigate this. Jul 26, 2014 at 9:25
  • (1) How does the server know that all clients sent a request, or is there always a fixed number of Clients? (2) What if a client dies or connection breaks before he could send his request? Sorry, but the whole idea sounds like a blueprint for disaster.
    – JensG
    Jul 26, 2014 at 17:04
  • First client sent a request with the ids of the clients which should send a request. I want to define some time limit , when all requests should be received, and to return response only to those clients which sent requests at this time
    – user681055
    Jul 26, 2014 at 17:40
  • How about Client1 sends a request to the server at 11:30:25. Server sends string response to client, eg. "11:31:00" - what tells him when to request again. Client1 waits until 11:31:00. Client2, Client3 and Client4 are sending requests at random time after 11:30:25, and server is responding "11:31:00" to all of them. They all wait until 11:31:00. When the time comes all clients send their requests to the server. If all 4 clients sent their request, server responds with some data.
    – VixinG
    Jul 27, 2014 at 0:25

2 Answers 2


This sort of scheme would require two-way communication between the server and it's clients. One straightforward approach would be to use the WebSocket protocol, but applications running on the .NET platform might benefit from SignalR.


Since WCF supports two-way communications, this is technically possible. When client C1 sends a request through the channel, the server sends the requests to C2, C3 and C4 and waits until those clients respond. Once all four responded, the server sends the final response.

But are you sure you want to do that?

It doesn't seem you gain anything compared to more ordinary communication patterns.

  • If you think that you gain bandwidth, you're not (you'll even waste a lot doing all the additional requests and responses).

  • If you think that the server footprint will be reduced by avoiding to generate the same response to multiple clients again and again, this is a false assumption as well: it will increase (again, because of those additional requests and responses). Caching, on the other hand, will be more appropriate.

The drawback is that if any of the four clients is down, the other ones will never receive the response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.