Reputation: 3142
I have a WCF service hosted with Net.TCP binding to which a lot of clients (> 100) may connect and receive various broadcast messages. The same message is sent to all clients and the current way I'm currently doing it is to have dedicated thread which waits on a BlockingCollection for new messages and as soon as new message arrives it iterates over the list of client callback connections and calls a method which receives the message as an argument.
So my code currently looks like this:
var msg = ... get message from queue ...
foreach(var client in clients)
client.SendMessage(message)
This design has following problems:
Does anybody has experience with such problems? Any tips/tricks/hints?
Upvotes: 3
Views: 2051
Reputation: 5369
It seems you have to use multicasts instead of dedicated communication. So each new client will need to join the cast channel (see IGMP for details) and then your server will fire-and-forget once per message you need to publish.
Upvotes: 1