Input and output buffer on the serial port
I wrote a 开发者_C百科small program that writes on serial port. I use SerialPort class (.NET Framework). When I write to serial port, immediately PortRecieved event was raised. Why program do that, when we know that serial port have input and output buffer. Write method writes to output buffer, read method reads from input buffer.
You'll need to check out the DataReceivedThreshold
property. It defines how many bytes will accumulate in the buffer before firing the DataReceived
event, and defaults to 1.
See also this Dev Center thread, which notes there may be some unexpected behavior with DataReceivedThreshold
in some cases.
精彩评论