I have created a Broadcast Server which must 10 clients at a time. It must be able to read data from 10 Clients at a time and reply through a Broadcast Message to all the Clients
. To make this communication fast, I have decided to make two Separate Threads at Server Side.
One Thread1 would be dedicated for Continuously receiving data and placing the data in a queue. Then this data is read from the queue by another Thread2 and processing is done.
i.e. the queue must be shared between Thread1 and Thread2.
How can I do it efficiently? How a queue is shared between these two threads?
And what if Thread1 is writing in the same Queue and Thread2 is reading?
Any help will be appreciated.