I am gettting a continous string of data from a device. The problem is that whenever I run my application, I always receive a error or warning dialog box. On which its written whether to continue or stop. Please have a look at my code and error window.
After getting string from device, I have only done string tokenzing. This should work but its giving me a problem.
First, you are configuring the serial port at the beginning of every loop and closing it at the end. It would be better to configure the serial port before the loop starts and close it after it ends. Why the delay after you first configure the serial port?
The error message is that data is coming in faster than you are reading it out of the buffer. How fast is the data coming in? How fast is the loop running, particularly that inner loop where data is being parsed?
How long is the data message that is coming in? If it is the same length each time, it might be better to read that number of bytes rather than just asking for the number of bytes in the buffer and reading only that. If the message is short, you would have incomplete data for your parser. It might be better to read the bytes inside the inner while loop and stop that once you have a complete message.
Attached is a cleaned up version of your code with the configure and close port functions moved outside the while loop.