SerialPort Members
The following tables list the members exposed by the SerialPort type.
Public Constructors
Name | Description | |
---|---|---|
SerialPort | Overloaded. Initializes a new instance of the SerialPort class. |
Public Destructors
Name | Description | |
---|---|---|
~SerialPort | Deletes an instance of the SerialPort class. |
Public Properties
Name | Description | |
---|---|---|
BaseStream | Gets the current instance as a stream. | |
BaudRate | Gets or sets the serial baud rate. | |
BytesToRead | Gets the number of bytes of data in the receive buffer. | |
BytesToWrite | Gets the number of bytes of data in the send buffer. | |
CanRead | Gets a value indicating whether the current stream supports reading. | |
CanSeek | Gets a value indicating whether the current stream supports seeking. | |
CanTimeout | Gets a value that indicates whether the current stream can time out. | |
CanWrite | Gets a value that indicates whether the current stream supports writing. | |
DataBits | Gets or sets the standard length of data bits per byte. | |
Handshake | Gets or sets the handshaking protocol for serial port transmission of data. | |
IsOpen | Gets a value indicating the open or closed status of the SerialPort object. | |
Length | Gets the length in bytes of the stream. | |
Parity | Gets or sets the parity-checking protocol. | |
PortName | Gets or sets the port for communications, including but not limited to all available COM ports. | |
Position | Gets or sets the position in the current stream. | |
ReadTimeout | Gets or sets the number of milliseconds before a time-out occurs when a read operation does not finish. | |
StopBits | Gets or sets the standard number of stopbits per byte. | |
WriteTimeout | Gets or sets the number of milliseconds before a time-out occurs when a write operation does not finish. |
Public Methods
Name | Description | |
---|---|---|
Close | Closes the port connection, sets the IsOpen property to false, and disposes of the internal Stream object. | |
DiscardInBuffer | Discards data from the serial driver's receive buffer. | |
DiscardOutBuffer | Discards data from the serial driver's transmit buffer. | |
Dispose | Releases the unmanaged resources used by the SerialPort object. | |
Flush | Sends any data waiting in the send buffer of this SerialPort and clears the buffer. | |
Open | Opens a new serial port connection. | |
Read | Reads a number of bytes from the SerialPort input buffer and writes those bytes into a byte array at the specified offset. | |
Seek | Sets the position within the current stream. | |
SetLength | Sets the length of the current stream. | |
Write | Writes a specified number of bytes to the serial port using data from a buffer. |
Public Events
Name | Description | |
---|---|---|
DataReceived | Represents the method that will handle the data received event of a SerialPort object. | |
ErrorReceived | Represents the method that handles the error event of a SerialPort object. |