Forum > Networking and Web Programming
Lnet LF terminated string
(1/1)
michoux:
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
engkin:
Use Split from SysUtils:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses ...SysUtils......var s:String; a:TStringArray;... .....GetMessage(s)... a:=s.Split(#$0A);
MarkMLl:
...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?
MarkMLl
Navigation
[0] Message Index