I am using C# Framework 4.0 for Serial Port communication.
I have defined ReceivedBytesThreshold as 51204; Initially the port is opened for low baud rate as 921600 for some purpose. After doing that Serial port is closed and disposed and reopened for some other task using higher Baud rate 1228800.
When number of bytes received is 51204, the DataReceivedHandler is fired.
private static void DataReceivedHandler(
SerialPort sp = (SerialPort)sender;
The problem is "BytesToRead" function is no more showing full bytes. It shows values like 51174, 51123 etc. less than 51204.
I have changed ReadBufferSize as well, but there is no effect on account of that.
When I used to open Serial port only once at Baud rate 1228800, the application works fine...but opening serial port for baud rate 921600 is necessary to carry out some task initially.
What can be done to receive full bytes?