Serial Port Interruptions

Hello Everyone,

I have a serial port application that routinely fires cmds and awaits data to return from a number of serial ports. Most of these are connected via serial/usb converters like the FTDI adapters that are available. The problem I sometimes run into is one of the serial devices gets ‘hung-up’ or the connection is broken (cable disconnected, etc.). When this happens, the app becomes unresponsive and the user must force-quit.

Can anyone suggest a method of using a watchdog or some other lightweight way to detect if the port is no longer working and allow me to close the port with grace?

Thanks, Sean

The only way I can think of is to track time between receives. If the timeout is reached, close and reopen the serial port.