Serial port lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- michoux · 2020-06-12 07:24 Hello, I am working on a project where I need to read the data from serial port and then send this data to some network server. Just for test I creatted button in lazarus with synaser. procedure TForm1.Button1Click(Sender: TObject); var str:string; begin   vscomport2.Open;       str:= vscomport2.ReadData();       showmessage(str); end;             I get following output 31 7   M.Civcija                                                  11    0.2                                                        11    0.3                                                        11    0.4                                                        11    0.6                                                        11    0.7                                                        11    0.8                                                        11    0.9                                                        11    1.1                                                        11    1.2                                                        Basically this is a running time of competitor on course - it is a timing software. ... I would need to read every line that comes in and parse it ... Any suggestion how to read every line separate?? Best regards Michoux ---------------------------------------------------------------------- mig-31 · 2020-06-12 13:40 Hi, if I understand you correctly, you want to read data from serial port, parse it and send to the network, for example using TCP/IP or UDP/IP. You can do that by using TBlockSerial class (unit Synaser) from Synapse library and Synapse, Indy or Lnet to send data to the network. Quote from: michoux on June 12, 2020, 09:24:09 am Just for test I creatted button in lazarus with synaser.  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i str:= vscomport2.ReadData(); TBlockSerial class from Synaser unit doesn't have method ReadData. To read each line mostly two technics are used: 1) if each line is terminated by special symbol or group of symbols you can use TBlockSerial.RecvTerminated method, 2) if each line consists of constant number of symbols you can use TBlockSerial.RecvBuffer method, where you specify number of bytes to read, then parse data and send it to the network. ---------------------------------------------------------------------- michoux · 2020-06-13 14:47 Thanks for reply. Actually yesterday I found tlazserial, which I think will do the job for me. What you recommend to use for network / socket connection? I need to send messagess, data from serial, to ip and port. ---------------------------------------------------------------------- mig-31 · 2020-06-18 10:09 My own opinion is the simplest one is Lnet library. https://wiki.lazarus.freepascal.org/lNet You can install it from onlinepackagemanages. Before it, you should install package onlinepackagemanager in Lazarus, which is a part of Lazarus installation. ---------------------------------------------------------------------- MarkMLl · 2020-06-18 12:30 Quote from: mig-31 on June 18, 2020, 12:09:01 pmMy own opinion is the simplest one is Lnet library. https://wiki.lazarus.freepascal.org/lNet You can install it from onlinepackagemanages. Before it, you should install package onlinepackagemanager in Lazarus, which is a part of Lazarus installation. But be aware that it is no longer actively supported by its authors, and that there's limited understanding of its internals in this forum. MarkMLl