Reputation: 11918
There's a threaded TCP server which creates a new thread for each client connection. Is it necessary to store all the connections in array in order to send a broadcast to all of them?
Upvotes: 0
Views: 707
Reputation:
Doesn't have to be an array, necessarily (it could be a hash or a tree or a bunch of threads with local variables..), but you do need to store all the connections somewhere in order to send to them. Otherwise they'd get GCed and closed.
Upvotes: 2