Serial port DataReceived firing too much.Most devices implement Handshake.RequestToSend, they use the RTS and CTS signals to tell the other side that it is ready to receive data and to prevent buffer overflow. Not initializing the SerialPort.Handshake property is a standard bug and the core reason why you don't get a TimeoutException when writing to the port when it is disconnected. The SerialPort.DsrHolding property is true when the device has turned on its DTR signal and can usually be interpreted as a power-on signal. The electrical standard does include handshake signals, about as close you could get to discover what is happening on the other end of the cable. Or never, Close() has several gritty deadlock problems. Don't call Close() until the very end of the program. It is never useful to use the IsOpen property, you want to immediately Open() the port so no other program can steal the port away from you. Just a raw byte stream, it sits at the very bottom of the OSI model, implementing the physical layer. There is no logical connection state and no error recovery, there is no way to share a serial port between multiple programs. It is where you plugged in your ASR-33 teletype to start banging in your Fortran program. They are very primitive devices that date back to the stone-age of computing. The term "life" has no useful meaning on serial ports.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |