Re: IdHTTPServer CommandGet multithreaded

Giganews Newsgroups
Subject: Re: IdHTTPServer CommandGet multithreaded
Posted by:  Remy Lebeau \(Indy Team\) (
Date: Wed, 12 Mar 2008

"Tomas" <tom…> wrote in message

> Could anybody explain how to make event
> HTTPServerCommandGet multithreaded?

It already is.  TIdHTTPServer (and all otehr TIdTCPServer descendants) is
multi-threaded internally.  Each client connection has its own thread, and
OnCommandGet is triggered in the context of those threads, not the main

> I use code below to receive and response to user request, everything
> works fine except that code below is not multithreaded

Yes, it is, implicitally.

> idHTTPServer do not take more incoming request until
> first request is finished.

Yes, it will.  The only way it wouldn't is if your own code is serializing
the threads manually, such as by using TThread.Synchronize() or the TIdSync

>  Job(ARequestInfo.PostStream); //Can take up to 10 seconds

You did not show what Job() actually does internally.



In response to

IdHTTPServer CommandGet multithreaded posted by Tomas on Wed, 12 Mar 2008