Hi all,

I carefully reread a FAQ and see other scenario.
Divide process into two pieces, download information from WEB site into main 
thread (ClientConnection) and run thread after data received only for database 
work.

My application is NNTP server with downloading information from one site, put 
it into database and news client get this information from database.

Client ask NNTP server for information, standard protocol. 
Server get request and ask information from database, then immediatelly reply 
to clent.
After it, server dynamically create some HttpCli and start downloading in 
asynchronous mode.
When In OnRequestDone server start a one or more individual threads only for 
heavy load database work. 
Thread do not cooperate with main thread, except OnTerminate Event.
During this operation client can ask other piece of information and this 
operation can start simultaneosy with paralel downloading a data and operating 
with database.

It is a right way? May be is other decision?

And now I have some questions:

1. What I set to property Multitreaded? I don't understand it.

2. Where and when I can destroy HttpCli
   a. In Event Handler OnRequestDone event, I think it's bad idea because it's 
a Event handler of HttpCli.
   b. I can send a user message itself, but how I can decide witch HttpCli I 
must destroy HttpCli.
   c. Destroy HttpCli on OnTerminate a thread.
   d. Destroy HttpCli on each Client request checking witch HttpCli is ready 
for destroy

3. In all examples I see that I must access HttpCli data with Memory Stream 
(ms.LoadFromStream(StringList) - is another method to access received data 
withou a stream? Directly. Like HttpCli.Get, HttpCli.Body.

I need your opinion about this scheme, how it right, another decision with 
simultaneously multi downloading from site and operate with received data with 
threads.

With best regards,
Anatoly Podgoretsky

----- Original Message ----- 
From: "Anatoly Podgoretsky" <[EMAIL PROTECTED]>

> I want use THttpCli within TTread, but when I close application it eception 
> with AV at address 0
> Code follow
> 
> constructor TBaseThread.Create;
> begin
>  inherited Create(False);
>  FreeOnTerminate := True;
>  HttpClient      := THttpCli.Create(nil);
> {
>  HttpClient.Agent          := 'Anatoly Podgoretsky NNTP Server';
>  HttpClient.MultiThreaded  := True;
> }
> end;
> //******************************************************************************
> // разрушение базового потока
> //******************************************************************************
> destructor TBaseThread.Destroy;
> begin
>  HttpClient.Free;
>  inherited;
> end;
> 
> What I'm doing wrong?
> Thread do nothing with main thread, this code only for testing. Real will 
> written in future
> 
> With best regards,
> Anatoly Podgoretsky
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to