On Tue, 3 Nov 2015 02:40:11 +0100, José Mejuto <joshy...@gmail.com> wrote:
>El 02/11/2015 a las 20:32, Bo Berglund escribió: > >>> IMHO using lnet or Synapse would be a lot "clearer" than using the >>> overly complex Indy Library. >> I had already looked at Synapse, but it is blocking. >> I did not know about lnet (or INet as it is shown when one searches) >> before but now I have had a look and it seems to fit the bill for me >> since it is event oriented, like I need for this particular task. >> > >I was following your thread from the beginning and or I do not >understand absolutely nothing about your needs or you are focusing the >problem in the opposite way. Let me explain me, I think you had >inherited a GUI app Not really... I had created a GUI program for talking to a data collection instrument via RS232 a long time ago. And to make things cleaner I had packaged all the specific communications functions in a class so the program only needed to call high level methods. The communications protocol is proprietary and binary and rather complex. >which you need to transform in a console one and The task I have to complete is to port the communications classes over to FPC/Lazarus so I can run a cron job for unattended data collection operations. THe controller is a Raspberry Pi2 with ARM7 CPU. And meanwhile the communications channel has switched from RS232 to TCPIP. >this GUI app uses events to coordinate data flows, so in example the app >connects to a server, gets a web page and some event handler process >this data and outputs something to a file. No, there is no web server or file involved at all! The instrument itself is a WiFi access point and it also exposes the internal serial communications line (which still exists internally) on a TCP port (like 2001 or similar). So I need to use a TCP client component for the connection instead of using a serial comm component. But the serial component is embedded in the communications class and it is built on incoming data being made available via an OnReceive event. So in order to make things work I need to replace that serial comm component with a TCP component that receives data in the same way as the serial one does. >event handler also updates information on screen (AKA TListView, ...) Now, this is the original topic of this thread since I discovered that the comm class also has helper methods to display received data on GUI components like TListView etc and so did not compile in Lazarus. THe helpers will not be called at all in the console case but by just being there and referencing TListView etc they stopped the compile until I was told to add LCL to the project dependencies. And when I did so the compilation worked and this thread should have been closed, but unfortunately it continued but changed topic to event driven network TCP communications... > >That's fine, but my question is why you need event sockets ? Because I want to change the serial comm to TCP comm in the existing code that is entirely event based for data reception. See above. > Code example follows... Well, if I had the opportunity and time to go ahead and rewrite the whole thing I might do it differently and maybe use your suggestions. But that is not an option given the size of the involved units... Right now I am just happy that Mark pointed me towards LNet, which is a TCP comm suite using the event model. It seems like this will be a solution for me. Initial testing -- Bo Berglund Developer in Sweden -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus