I am just reviewing some code I wrote to communicate with the serial port in C# on CF2.0.
I am not using DataReceived event since it's not reliable. MSDN states that:
The DataReceived event is not
gauranteed to be raised for every byte
received. Use the BytesToRead property
to determine how much data is left to
be read in the buffer.
I poll the port with read() and have a delegate that processes the data when it is read. I also read somewhere that "polling is bad"(no explanation given).
Any ideas why polling might be bad? aside from the usual threading cautions – I have a separate thread (background thread) that polls the port, the thread is exited after the data is read, all tested and works well.