If SerialPort.Write () is a blocking operation (or it is not) what will the BytesToWrite () method need. He would always evaluate to zero, forcing the last write operation either to succeed in writing all the data, or otherwise, in any case, the bytes to be written would be zero.
Perhaps this is more than what I described.
SerialPort.Write- blocking operation, yes. However, two buffers must be considered: a serial device and buffers SerialPort.
SerialPort.Write
SerialPort
SerialPort , , . , , . .
SerialPort , , . (*), , , .
SerialPort.BytesToWrite , SerialPort.
SerialPort.BytesToWrite
(*) UART , .
- /, . 9600 . , 60 000 000 . , 125 000 000 .
, , , , , UART. Write(). , , , , Write(). WriteBufferSize - BytesToWrite , .
SerialPort BytesToWrite .
On the other hand, the SerialPort Write method (line text) Writes the specified line to the serial port.
Do you know how the serial port works? The sequence sends a certain number of bytes every second, depending on the bot used.