Using Serial in a TCP/RS232 gateway, how to set buffer sizes?

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Using Serial in a TCP/RS232 gateway, how to set buffer sizes?

Bo Berglund
On Fri, 08 Sep 2017 14:54:33 +0200, Bo Berglund
<[hidden email]> wrote:

>But how?
Never mind this...
I found the wiki article:
http://wiki.freepascal.org/Multithreaded_Application_Tutorial

--
Bo Berglund
Developer in Sweden

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Using Serial in a TCP/RS232 gateway, how to set buffer sizes?

wkitty42
In reply to this post by Bo Berglund
On 09/08/2017 04:34 AM, Bo Berglund wrote:
> Next I unchecked the checkbox before doing the long transfer, and
> lo-and-behold(!) now there are no losses anymore!
>
> So the action of writing text to the listbox in the LogHex function
> was actually causing the application to lose incoming serial data!


this tells you right off that you should have at least XON/XOFF flow control so
the receiver can tell the sender to hold up a second and let it get the buffer
worked down... at least this with good buffer level monitoring...


--
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list unless*
        *a signed and pre-paid contract is in effect with us.*
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Using Serial in a TCP/RS232 gateway, how to set buffer sizes?

Michael Schnell
In reply to this post by Bo Berglund
On 06.09.2017 20:35, Bo Berglund wrote:
> The problem is that when the Windows app is done sending the data
> system is still missing many kilobytes....
> So no ACK is returned, it is still in receive mode.
>
On serial lines bits and bytes always can get lost or be distorted,
independent from OS, hardware, ...

Any data transfer software needs to use appropriate means (i.e.
appropriately small packets. counting packet number. ACK block
containing the packet number it answers to, timeout, retransmit, ...) to
handle this.

Moreover, with USB serial adapters I rather often found that the loose
the connection to the OS and can't be re-established without a power cycle.

-Michael


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Using Serial in a TCP/RS232 gateway, how to set buffer sizes?

Michael Schnell
In reply to this post by Bo Berglund
On 06.09.2017 20:35, Bo Berglund wrote:....
> ...
(i.e. appropriately small packets. counting packet number. ACK block
containing the packet number it answers to, timeout, retransmit, ...)

Not to forget: save detection of block start and block end (and hence
introducing a decent transparentizing scheme, and using a block check
(e.g. CRC).

-Michael

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
12