One Producer - Many Consumers - Same Message
I hope this hasn't been asked before, but every time I search I never find help for my specific problem.
I have a program that does the following. Has one incoming TCP connection. Has many outgoing TCP connections. Each connection is in a separate thread. When I receieve a new string from the incoming I want to send it to all outgoing connections.
Currently I am just a Variable that gets overwritten w/ each new incoming message. I am afraid that it will get overwritten before it is sent on all outgoing connections. So I want to use a queue. However, and this is what I see in examples all over the web, once the outgoing pops from the queue, the other ones don't have that message anymore. So how do I pop it off once all consumer threads send the message off?