On Wed, 6 Sep 2017 18:58:57 +0000, Mark Morgan Lloyd <markmll.fpc-pas...@telemetry.co.uk> wrote:
>> Is there some hidden property that makes it possible to increase thisvalue? >>What is the maximum size one can set it too? > >Not that I was responsible for. Refer to the Windows API for any limits. I might add that the problem manifests itself on transmission from the Windows application (Delphi XE5). I.e. the relaying Lazarus/FPC application loses incoming bytes after some time of processing the streams. Small data sizes work just fine but with the 1 Mbytes packet some kbytes are lost. And here is the core procedure where the relaying happens: procedure TfrmMain.RelayData; {This procedure is responsible for transferring the data from one side to the other. It will run until one of the ports are closed as indicated by the flags FTcpConnected and FComOpen} var Buf: TIdBytes; LenRd, BufLen: integer; RxSer, TxSer, RXTcp, TxTcp: integer; begin RxSer := 0; TxSer := 0; RxTcp := 0; TxTcp := 0; BufLen := 50; FTcpComm.ReadTimeout := 30; while (FComOpen and FTcpConnected and FRelayOn) do begin //First check TCP data try SetLength(Buf, 0); if FTcpComm.IOHandler.CheckForDataOnSource(10) then begin FTcpComm.IOHandler.ReadBytes(Buf, -1, false); if Length(Buf) > 0 then begin Inc(RxTcp, Length(Buf)); SerWrite(FComH, Buf[0], Length(Buf)); Inc(TxSer, Length(Buf)); LogHex('Rx', Buf); SetLength(Buf, 0); end; end; except on E: Exception do Showmessage('TCP read exception: '#13 + E.Message); end; //Next check serial data SetLength(Buf, BufLen); LenRd := SerRead(FComH, Buf[0], BufLen); if LenRd > 0 then begin SetLength(Buf, LenRd); Inc(RxSer, LenRd); try FTcpComm.IOHandler.Write(Buf, LenRd); Inc(TxTcp, LenRd); LogHex('Tx', Buf); SetLength(Buf, 0); except on E: Exception do Showmessage('TCP write exception: '#13 + E.Message); end; end; //Finally show data and check events stxSerRx.Caption := IntToStr(RxSer); stxSerTx.Caption := IntToStr(TxSer); stxTcpRx.Caption := IntToStr(RxTcp); stxTcpTx.Caption := IntToStr(TxTcp); Application.ProcessMessages; end; end; Where could I be losing incoming serial data? -- Bo Berglund Developer in Sweden _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal