Michael Schnell wrote:
On 10/21/2015 12:33 AM, Bo Berglund wrote:
As Mark Morgan Lloyd has pointed out I *really* need to create an
encapsulated class for the TCPIP communications so I can use this as
an alternate component in the existing object and for this I need to
implement an onReceive event to plug the incoming data into it
Sorry to be a PITA, again, but a command line application (which in the
other message you said you would want to do) does not support throwing
events from threads out of the box. (There is no Lazarus Linux workalike
for a Delphi Service Application.). You would have to implement your own
"main loop" to make this happen.
That is why, to use the standard Lazarus and Delphi programming
paradigms, I suggested to do a normal Lazarus GUI application on the RasPi.
Which is fine as a testbed, but not necessarily for production use. It's
particularly not fine if you want to start it on a regular basis from
cron or whatever, which I think Bo has already settled on.
I'm very much in two minds on this. I'm intermittently working on a
couple of fairly large programs which have elements of both daemon and
UI, having them as standard Lazarus apps makes inspection and debugging
much easier but inserts a large amount of complexity- X11, the widget
set (GTK or Qt), all of the LCL stuff- all of which has the potential
for bugs and unintended interactions.
Even if Bo did decide not to use cron but instead to have a Lazarus app
with its own embedded timing, he'd still have to organise startup and
having a screen- real or simulated- to run it on. And since a Raspberry
Pi needs a keyboard etc. in order to have a local screen, and since he's
not sorted out automatic VNC startup etc., I don't think this is the way
for him to go.
So noting your concern with events, the real question is still which
libraries etc. he should be running to implement a socket client
reliably in a console program. Or alternatively, how best to implement a
Windows-style service using Lazarus, which doesn't mandate a screen and
an initial login.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus