SerialError 枚举


指定在 SerialPort 对象上发生的错误。Specifies errors that occur on the SerialPort object.

public enum class SerialError
public enum SerialError
type SerialError = 
Public Enum SerialError


Frame 8

硬件检测到一个组帧错误。The hardware detected a framing error.

Overrun 2

发生字符缓冲区溢出。A character-buffer overrun has occurred. 下一个字符将丢失。The next character is lost.

RXOver 1

发生输入缓冲区溢出。An input buffer overflow has occurred. 输入缓冲区空间不足,或在文件尾 (EOF) 字符之后接收到字符。There is either no room in the input buffer, or a character was received after the end-of-file (EOF) character.

RXParity 4

硬件检测到奇偶校验错误。The hardware detected a parity error.

TXFull 256

应用程序尝试传输一个字符,但是输出缓冲区已满。The application tried to transmit a character, but the output buffer was full.


当处理SerialPort.ErrorReceived事件时, 此枚举可能非常有用, 可以在SerialPort通过传递数据时检测并响应错误。This enumeration can be useful when handling the SerialPort.ErrorReceived event to detect and respond to errors when communicating data through a SerialPort. 可以通过检索SerialErrorReceivedEventArgs.EventType属性来检查错误类型。You examine the type of error by retrieving the SerialErrorReceivedEventArgs.EventType property. 属性包含SerialError枚举中的一个值。 EventTypeThe EventType property contains one of the values from the SerialError enumeration.