C# check if a COM (Serial) port is already open

Posted by TK on Stack Overflow See other posts from Stack Overflow or by TK
Published on 2008-10-12T13:24:38Z Indexed on 2010/03/20 19:21 UTC
Read the original article Hit count: 245

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET