Author Topic: Lnet LF terminated string  (Read 1097 times)


  • New Member
  • *
  • Posts: 49
Lnet LF terminated string
« on: May 28, 2021, 09:25:56 am »
Hello I use Lnet to connect to server.
Server sends a string from time to time.
I read it with GetMessage
String contains "lines" terminated  by LF - line feed

In  TCPBlockSocket there is nice option "connection.RecvTerminated" which will brake string by lines so I can read it line by line and parse it.
Is there such option in lnet?

Regards Matija


  • Hero Member
  • *****
  • Posts: 2853
Re: Lnet LF terminated string
« Reply #1 on: May 28, 2021, 03:10:57 pm »
Use Split from SysUtils:
Code: Pascal  [Select][+][-]
  1. uses ...SysUtils...
  2. ...
  3. var
  4.   s:String;
  5.   a:TStringArray;
  6. ...
  7.   .....GetMessage(s)...
  8.   a:=s.Split(#$0A);


  • Hero Member
  • *****
  • Posts: 2841
Re: Lnet LF terminated string
« Reply #2 on: May 28, 2021, 05:12:15 pm »
...although that wouldn't handle the cases where one end of the streamed data or the other comprised an incomplete line.

I've got two questions: (i) why is the protocol terminating on LF rather than on CRLF which is the Internet standard and (ii) is OP using the LNet implementation bundled (as a tool and unsupported) with FPC or the one from Github etc. which is really where questions should be directed?

Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories:


TinyPortal © 2005-2018