[fpc-pascal] fcl-web TFPHttpServer component problem
Leonardo M. Ramé
martinrame at yahoo.com
Mon Nov 28 11:50:52 CET 2011
>________________________________
> From: Graeme Geldenhuys <graemeg.lists at gmail.com>
>To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
>Sent: Monday, November 28, 2011 7:42 AM
>Subject: [fpc-pascal] fcl-web TFPHttpServer component problem
>
>Hi,
>
>I was testing the newish HTTP Server component located in
>fcl-web/src/fphttpserver.pp
>
>I simply created a form with Start/Stop button. The problem is, that
>once I call .Active := True, it never returns from that call, so my
>test program (and thus any program using this server component) is
>stuck in limbo land...
>
>Is this a known problem? And more importantly, is there a work-around?
>I'm using FPC 2.5.1 (the latest revision in the 2.6.0 fixes branch).
>
>
>procedure TMainForm.ButtonClicked(Sender: TObject);
>begin
> if Button1.Text = 'Start' then
> begin
> writeln('before start');
> FHTTPServer.Active := True;
> writeln('after start');
> Button1.Text := 'Stop';
> end
> else
> begin
> writeln('before stop');
> FHTTPServer.Active := False;
> writeln('after stop');
> Button1.Text := 'Start';
> end;
>end;
>
>
>Note:
>Once the HTTP Server is running, it does correctly handle and respond
>to HTTP requests, so the worker thread of the http server is working.
>It is just that the program implementing the HTTP Server component is
>frozen, and its process has to be killed to terminate the http server.
>
>
>--
>Regards,
> - Graeme -
>
>
I think that class was meant to be used as the main program loop. Didn't tested, but what happens if you use it inside a TThread?.
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the fpc-pascal
mailing list