BBC BASIC for Windows
« Discovering which COM ports are free? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:53pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Discovering which COM ports are free?  (Read 659 times)
g3nrw
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 74
xx Discovering which COM ports are free?
« Thread started on: Feb 18th, 2015, 7:04pm »

Hello again. A variation on COM port questions I have asked before:

I have a program that needs to discover which COM ports are free. I have tried the simple way:

1. Attempt to open each port on the system.

2. If the open is successful, that port is available for use.

3. Immediately close the port.

This is fine, except the act of opening a port, however briefly, can cause other programs using the COM ports (over which I have no knowledge or control) to hiccup. I have a user with this problem right now.

There must be a way in BB4W to test for free COM ports without attempting to open them, but I can't see how. Any pointers?

--
Ian
User IP Logged

rtr2
Guest
xx Re: Discovering which COM ports are free?
« Reply #1 on: Feb 18th, 2015, 8:27pm »

on Feb 18th, 2015, 7:04pm, g3nrw wrote:
the act of opening a port, however briefly, can cause other programs using the COM ports (over which I have no knowledge or control) to hiccup.

My guess is that the 'other program' isn't using legitimate Windows API calls to open the port, and that instead it's using some low-level direct port access using a driver such as INPOUT32.DLL. Windows may not even be aware the port is in use.

If that's the case, there's nothing you can do about it. The other program is at fault, not you. You will need to politely inform your user that he is using a program which breaks the rules of Windows. It will potentially be exposing security loopholes too.

As a workaround, could you perhaps provide a configuration option in your program allowing the user to specify ports that must not be scanned?

Windows should provide complete isolation between programs which open a serial port 'properly', and I have no reason to think it doesn't.

Richard.
« Last Edit: Feb 18th, 2015, 8:29pm by rtr2 » User IP Logged

g3nrw
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 74
xx Re: Discovering which COM ports are free?
« Reply #2 on: Feb 21st, 2015, 6:15pm »

I was thinking exactly the same. The chances of getting someone else to modify their software is pretty remote, so I have given up in that direction.

For now, then, I will simplify the program by reading the Windows Registry to build a list of which serial ports exist on the system, and then present the list to the user to choose from.

Thanks for your help.

--
Ian


User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls