I'm communicating with an external device from C# via a COM port in Windows. I'm thinking that the best way to move messages back and forth between my code and the device is via a message queue. This way, I can push the request onto the stack, and handle the response whenever it's received from the device. Hopefully this will free up the front end, especially since the Serialport
response is async. Can anyone recommend a queue that I can use that's fully contained within my app with no need for an external DB or MSMQ? Thanks!
Asked
Active
Viewed 1,180 times
0

davidbitton
- 818
- 10
- 20
-
Does the queue have to live beyond your app's lifetime? That is, can you lose unsent messages if your app exits or crashes? – n8wrl Aug 25 '16 at 17:19
-
1ConcurrentQueue? https://msdn.microsoft.com/en-us/library/dd267265(v=vs.110).aspx – William Xifaras Aug 25 '16 at 17:34
-
I would recommend a state machine. See [this thread](http://stackoverflow.com/a/38536373/2009197). – Baddack Aug 26 '16 at 21:57
-
@n8wrl yes, it only needs to live for the lifetime of the app. – davidbitton Aug 26 '16 at 22:41