Hi All,
I have an windows form application that communicates (reads\writes) with a device through SPP.
The typical communication cycle is:
1 the application sends a command
2 the application wait for a response, which is always and quickly sent back by the device.
I have a wclSyncClient which is created in the UI thread at the application start (the channel is opened at the same time), then it's used in both the UI thread by some event handler that responds to user actions, and in other background threads. Every access to the client is synchronized through locks.
What happens is that, sometimes, in the background threads, the Read method cannot receive anything, I also have a retry policy, Read is called several times, always with 0 byte read.
After that, when the users triggers a command by using the UI, all the data I was expecting are now received by a the first Read attempt.
I noticed that the odd behaviour occours mostly when the background operation is performed immediatly next to a UI triggered one.
Because of that I suspect that the wclSyncClient is not thread-safe, what are your thoughts?
Thanks in advance,
Luigi