Re: IdHTTPServer CommandGet multithreaded

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

"Tomas" <tom…@gmail.com> wrote in message
news:6EB2F8D0F24BE340tom…@gmail.com...

> 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
thread.

> 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
class.

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

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

Gambit

Replies

In response to

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