[fpc-pascal] fcl-web TFPHttpServer component problem

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Nov 28 14:19:40 CET 2011



On Mon, 28 Nov 2011, Graeme Geldenhuys wrote:

> On 28/11/2011, Leonardo M. Ramé <martinrame at y.....> wrote:
>>
>> I think that class was meant to be used as the main program loop.
>
> If so, that's a pretty dumb design.

Ah. And why is that so ?

> Also the HTTP server is
> implemented as a component (TComponent descendant), so I gather the
> thoughts was that some day they would like it to sit on the Lazarus
> component palette, where it will be dropped onto some form or data
> module - thus rendering that application frozen too.

It was never meant as such.

It is meant as the "main program loop", as Leonardo surmised. 
The component is meant to be simple.

And using a TComponent does not automatically mean that it will sit on the
component palette. I use TComponent because I like the automated memory 
management it offers; e.g. it also means the TDatamodules it creates for
servicing requests can be owned by the server component itself.

If you want still to have a "main program", you should use a thread and
create the component in the thread. Which is exactly what happens in a
service application, the intended environment for the component.

Michael.


More information about the fpc-pascal mailing list