SerialPort.IsOpen - Speed up response
Hello,
I am doing some communication with a bluetooth device, using the System.IO.Ports.SerialPort class.
This is going ok, but I'm trying to handle disconnections gracefully and it's a bit slow.
Currently I ping my device every five seconds, and expect a response within a few seconds. If this fails I check
SerialPort.IsOpen
and if it's not I try SerialPort.Open. Using a timer I repeat IsOpen -> Open until IsOpen returns true.
I can't think of anything better than pinging my device frequently, however SerialPort.IsOpen seems very slow (~10 seconds) before it decides that the port is closed.
Does anyone have any ideas please? Far short of writing my own serial port class I'm a bit stuck. No amount of googling is helping either.
Many thanks for your time,
Russ