[fpc-pascal] Serial to TCP gateway in FPC?
Bo Berglund
bo.berglund at gmail.com
Wed Jun 21 07:27:36 CEST 2017
On Wed, 21 Jun 2017 01:57:36 +0200, José Mejuto
<joshyfun at gmail.com> wrote:
>> The problem I have is that it seems only to work for COM1 or COM3, as
>> soon as I use a higher numbered port like COM33 then it fails.
>> What have I missed here?
>> Is serial only able to work with the low numbered ports (single
>> digit)?
>
>COM ports in windows can only be 1-9, to open high numbered COM ports
>you must use the extended name syntax (without quotes) "\\.\COM99" you
>can also use "\\.\COM1" for COM1-9.
It turns out that I also must not use the trailing colon in the name
which is present in the wiki example...
But then I get a non-zero handle. I have yet to verify that data can
flow.
Is there a way to enumerate the available com ports so that they can
be listed in a combobox for selection? This would have the advantage
that it would work on both Windows and Linux and it limits the
possible errors by the user. Of course the enumerator must know about
the differences in syntax between Windows and Linux!
What about Linux (Raspberry Pi)? Is the com port name simply ttyUSB1
or do I have to use the full /dev/ttyUSB1?
--
Bo Berglund
Developer in Sweden
More information about the fpc-pascal
mailing list