LB Booster
« opening more than 4 COM ports at the same time »
Welcome Guest. Please Login or Register. Apr 1st, 2018, 03:54am
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. We apologize Conforums does not have any export functions to migrate data. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
Re: opening more than 4 COM ports at the same time
« Reply #4 on: Jan 9th, 2017, 12:14pm »
Thank you for the suggestion. It is of course possible to close and open the ports one by one , but some of the devices transmit the data asynchronously and there is a risk of loosing the data. Not all of them can respond to messages. It was a question rather to clarify if I was doing some mistake or if the problem was in some limits that I was not aware of. The answer was very fast so Thanks again.
It was a question rather to clarify if I was doing some mistake or if the problem was in some limits that I was not aware of.
I am confident that it should be possible to overcome the limit quite easily. Basically the trick will be to re-use the same 'handle' for more than one serial port, so for example if each handle is shared between two ports, it would raise the limit to 8 simultaneously-open ports.
One approach, which seems to work, is to provide a 'swap port' function that switches the given handle to an alternative port. A slight complication is that it's not straightforward to pass a handle as a parameter in Liberty BASIC (handles are always global) so I've been experimenting with either passing the handle as a string, or passing the native Windows handle (which you can get with the HWND function in LBB).
Unfortunately I am busy with other projects at the moment so I haven't been able to give this as much attention as it deserves.