I have a DataReceived method being trigger a data is send from a RS232 device. Things run smoothly with the following code
byte[] data = new Byte[serialPort.
The DataReceived
method will be triggered when the serial port feels like triggering it, which is NOT necessarily when you receive a full string from the device. See this SO answer for a great discussion of the details. If you have a known terminator character, you can work around this problem by setting the NewLine
property of the SerialPort, and then using ReadLine()
.