how to search for valid com ports?

For issues with communication ports, protocols, etc.
Post Reply
more granularity
Posts: 1
Joined: Oct 25, 2012 17:19

how to search for valid com ports?

Post by more granularity »

I want to search for a com port that an instrument has been plugged into.
So I would like to go through all possible com ports, test which ones are
valid, and then test which valid port has data on it.

If I try to open a non existent com part, is there an error I can access?

When I check ERR after trying to open an invalid com port I always get 0.

Any suggestions?

TIA
bfuller
Posts: 362
Joined: Jun 02, 2007 12:35
Location: Sydney, Australia

Re: how to search for valid com ports?

Post by bfuller »

You might be able to make use of this code, or parts of it.

http://www.freebasic.net/forum/viewtopi ... en#p153272

If you scan all available ports to see what is happening on each perhaps ????
Zippy
Posts: 1295
Joined: Feb 10, 2006 18:05

Re: how to search for valid com ports?

Post by Zippy »

I want to search for a com port that an instrument has been plugged into.
So I would like to go through all possible com ports, test which ones are
valid, and then test which valid port has data on it.
<snip>
Your operating system is...?
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: how to search for valid com ports?

Post by St_W »

if you're using Windows the easiest way is to look into the registry:
HKLM\HARDWARE\DEVICEMAP\SERIALCOMM lists all ports

Sample code
Post Reply