On windows, the easiest way is trying to open COM1, COM2 in sequence and see whether open succeeded.

If you’ll enumerate more than 10 ports, you should name them as \\.\COM10 etc.

 

 

From: Boost-users <boost-users-bounces@lists.boost.org> On Behalf Of Tim Burgess via Boost-users
Sent: Wednesday, September 5, 2018 12:46
To: boost-users list <boost-users@lists.boost.org>
Cc: tim@raisedbar.net
Subject: [Boost-users] ASIO?

 

Hi,

 

I’m looking for a mechanism allowing me to enumerate serial (Com) ports on Windows/Mac. I also need to be able to retrieve the name of a given serial device. I’ve had a quick look at boost::asio, but it isn’t clear to me if it can do what I want.

 

I’d be grateful for any advice, including alternatives if boost and/or ASIO aren’t up to the job.

 

Best wishes.

 

Tim Burgess

Raised Bar Ltd.

E: tim@raisedbar.net

M: +44 (0)7989 486976