This property returns the most recent communication event or error.
object.CommEvent
The CommEvent property is unavailable at design time. It is read-only at run time.
Although the OnComm event is generated whenever a communication error or event occurs, the CommEvent property holds the numeric code for that error or event. To determine the actual error or event that caused the OnComm event, you must reference the CommEvent property.
The following table shows the CommEvent errors.
Constant |
Value |
Description |
comNoError | 0 | No Error. |
comEventBreak | 1001 | A break signal was received. |
comEventCTSTO | 1002 | Clear To Send Timeout. The Clear To Send line was lower than the system- specified amount of time used when transmitting a character. |
comEventDSRTO | 1003 | Data Set Ready Timeout. The Data Set Ready line was lower than the system specified amount of time used when to transmitting a character. |
comEventFrame | 1004 | Framing error. The hardware detected a framing error. |
comEventOverrun | 1006 | Port overrun. A character was not read from the hardware before the next character arrived and was lost. |
comEventCDTO | 1007 | Carrier detect timeout. The carrier detect line was low for the system specified amount of time while trying to transmit a character. carrier detect is also known as the Receive Line Signal Detect (RLSD). |
comEventRxOver | 1008 | Receive buffer overflow. There is no room in the receive buffer. |
comEventRxParity | 1009 | Parity error. The hardware detected a parity error. |
comEventTxFull | 1010 | Transmit buffer full. The transmit buffer was full when trying to queue a character. |
comEventDCB | 1011 | Unexpected error retrieving Device Control Block (DCB) for the port. |
The following table showss the CommEvent events.
Constant |
Value |
Description |
comEvSend | 1 | There are fewer than SThreshold number of characters in the transmit buffer. |
comEvReceive | 2 | Received RThreshold number of characters. This event is generated continuously until you use the Input property to remove the data from the receive buffer. |
comEvCTS | 3 | Change in Clear To Send line. |
comEvDSR | 4 | Change in Data Set Ready line. This event is fired only when DSR changes from 1 to 0. |
comEvCD | 5 | Change in carrier detect line. |
comEvRing | 6 | Ring detected. Some UARTs (universal asynchronous receiver-transmitters) may not support this event. |
comEvEOF | 7 | End Of File (ASCII character 26) character received. |