Is there an easy way of programmatically checking if a serial COM port is already open/being used?
Normally I would use:
try { // open port } catch (Exception ex) { // handle the exception }
However, I would like to programatically check so I can attempt to use another COM port or some such.
I needed something similar some time ago, to search for a device.
I obtained a list of available COM ports and then simply iterated over them, if it didn’t throw an exception i tried to communicate with the device. A bit rough but working.