Hi Francois

Thank you very much for taking the time to answer these and for your 
detailed response.

Much appreciated.

Wilf


>From: "Francois Piette" <[EMAIL PROTECTED]>
>Reply-To: ICS support mailing <[email protected]>
>To: "ICS support mailing" <[email protected]>
>Subject: Re: [twsocket] HTTPCli in multithreaded application
>Date: Mon, 10 Apr 2006 16:26:28 +0200
>
> > I am new to ICS. I wish to use the HTTPCli component in a multithreaded
> > application to test the response from websites. Any thread within the
> > application may use an HTTPCli object to make such a test.
>
>No problem to do that. Note that you probably don't need to use 
>multithreading to do what you want.
>In most cases it will only slow down overall operations because the 
>overhead incured switching from
>thread to thread os likely to be superior to the CPU usage of the 
>component. Use multithreading for
>your processing or use multithreading if you have a really large number of 
>concurrent components. On
>thread is enough for 50 or more components if there is no processing done 
>on data.
>
> > My preferred approach would be: within a thread, create an HTTPCli 
>object
> > dynamically using the create method, and set the URL property. Then set
> > handlers for onDocData, and onRequestDone and retrieve the page using 
>the
> > Get() function. Use an exception handler to trap any problem with Get().
> >
> > - Do you see any potential problems with this, given that it will occur 
>in a
> > multithreaded environment?
>
>It is OK. Be sure to create the HttpCli component from the thread's Execute 
>method or his events
>would be handled by the main thread ! TThread constructor run in the 
>context of the main thread.
>Only Execute run in the created thread context.
>
> > - Are there any problems with having multiple HTTPCli objects running in
> > multiple threads as described?
>
>Be sure to access a given HttpCli object from a single thread at a time.
>Be sure to have a message pump in each of your thread or no event would be 
>triggered.
>
> > - Also, do I need to set the multithreaded property to true?
>
>Yes, it is the purpose of this property.
>
> > Thank you in advance for any assistance you can give.
>
>You're welcome.
>Have a look at the sample programs.
>
>--
>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
>
>
>--
>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