[Lazarus] fpWeb long process progress
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Tue Aug 14 16:29:16 CEST 2012
On Tue, 14 Aug 2012, Leonardo M. Ramé wrote:
> On 2012-08-14 09:47:41 +0200, Michael Schnell wrote:
>> AFAIK, a web application uses the plain old standard mechanism, a
>> web server uses to work with a CGI application. it start the
>> application and when same ends, the web server retrieves its output
>> and sends it to the browser. So the web application just does not
>> live long to be able to wait for anything.
>>
>> To create a longer living web enabled process it takes a lot more effort.
>>
>> You can try several approaches:
>>
>> - purely propriety: Use a second process (a long living daemon) and
>> have the web application communicate with same (e.g. via TCP/IP or
>> Pipe)
>> - fast CGI: here the (Apache) Web Server does exactly this
>> communication on it's own account
>> - ISAPI: here a (Microsoft) Web server communicates with a DLL
>>
>> My colleagues do a combination of (1) and (3) with one of their
>> (Delphi) project very successfully:
>>
>> They created a very simple ISAPI DLL (using RemObjects to do the
>> ISAPI communication)
>>
>> They created a Windows service and used RemObjects (using the
>> "Windows Message" transport) to have the ISAPI DLL communicate with
>> the service.
>>
>> (RemObjects is a commercial product that is specified to work as
>> well with Delphi as with FreePascal.)
>>
>> -Michael
>
> Thanks Michael, I'm testing a different approach, based on a temporary
> file. It works this way:
>
> 1) The client asks for a TaskId, for example 1234.
> 2) With the TaskId generated by the server, the client calls a CGI
> method called runLongTask(myTaskId). This method writes a temporary file
> which name is the taskId.
> 3) The client can ask for status by using a method called
> getTaskStatus(myTaskId).
>
> This way I can run a long task without having to create a daemon.
That is exactly what I do.
Michael.
More information about the Lazarus
mailing list