> What I'm doing wrong?

Your HTTP component runs in the main thread since you created in the context
of the main thread (TThread constructor execute in the context of the
calling thread, not in the context of the created thread). Create you HTTP
component instance from the thread's Execute method and free it at the end
of the Execute method. Don't forget to have a message pump within your
Execute method also. Look at the multithread sample programs delivered with
ICS. See their creation date. Generally to more recent the better they are.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


----- Original Message ----- 
From: "Anatoly Podgoretsky" <[EMAIL PROTECTED]>
To: "TWSocket List" <twsocket@elists.org>
Sent: Thursday, October 05, 2006 10:05 PM
Subject: [twsocket] How to use THttpCli with threads?


> Hi!
>
> 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
>

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