Mihcael

Mihcael

  • NA
  • 1
  • 10.3k

Checking for dropped connection with SerialPort class

Jan 12 2011 11:00 AM
I'm using the SerialPort class in c#/Visual Studio to monitor data coming in from COM port 10. The problem I am having is when the device sending data to port 10 is disconnected or switched off. Using the 'isOpen' method does not work, as it will still return true as the instance of SerialPort still thinks there is a connection.

I've tried looping through SerialPort.portNames, and that doesn't work either. It simply says that all the ports are closed.

How can I test for when the connection is dropped?

Thanks for your help.

Michael