Will only BlockingCollection or TPL with BlockingCollection will be suitable for this case: program will gather data from multiple socket streams (will act as client). Get Packet from socket, forward it to the central processor. Central processor will do calculations, reply back to socket threads and will tell GUI thread to update the GUI. Central processor, socket threads and GUI thread all will need queue. The Data flow is from socket threads to GUI through central processor. I am not sure of using TPL here. So need some guidance.
Asked
Active
Viewed 52 times
0
-
Do I understand correctly that you want to implement a multi producer single consumer model in a bi-directional way? – Peter Csala Dec 07 '20 at 08:47
-
yes..right..First step is mutiple producers will send data to single consumer which will forward it to GUI – AdtG Dec 07 '20 at 14:13
-
The TPL provides the primitives for all parallel/async/concurrent/dataflow classes, so you'll use it one way or another. If you model your application as a dataflow (ie a pipeline of processing blocks) you can use the TPL Dataflow library or Channels. Even if you don't have a pipeline, a single `ActionBlock` is essentially a multi-threaded worker with a concurrent input buffer – Panagiotis Kanavos Dec 08 '20 at 15:50