Re: [twsocket] HTTPCli in multithreaded application

2006-04-12 Thread Albjan
Hello,

Just finished a application that creates a HTTPCli object dynamically in
threads.
Some 100 Pc's needs to be ping (network performance) and then 5 different
httpcli-head actions on that Pc (wifi proxy testing).  
The only way it works without memory losses (with BCB6.0) is to use it ASYNC
in the thread.
The HTTPCli object can be used for more than one request.
Multithreaded doesn't matter.

Regards Albert

  

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] Namens Wilfred Owen
 Verzonden: maandag 10 april 2006 11:10
 Aan: twsocket@elists.org
 Onderwerp: [twsocket] HTTPCli in multithreaded application
 
 Hello
 
 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.
 
 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?
 - Are there any problems with having multiple HTTPCli objects 
 running in multiple threads as described?
 - Also, do I need to set the multithreaded property to true?
 
 Thank you in advance for any assistance you can give.
 
 Wilf
 
 
 --
 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


Re: [twsocket] HTTPCli in multithreaded application

2006-04-12 Thread Wilfred Owen
Thanks Abjan and Arno for your suggestions. I will be reading those 
articles. At the moment I have set up a test brace with a thread/message 
pump, and it is working well. I may have more questions as I try more things 
out, but it looks good so far.

Thanks again for you help - I'm very impressed with this mailing list!

Wilf


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


Re: [twsocket] HTTPCli in multithreaded application

2006-04-10 Thread Dod
Hello Wilfred,

Main question is why use threads ? ICS main advantage is to work in
non threaded model, just create 10, 20, 30 instances of THHPCli and
connect them :-)

WO Hello

WO I am new to ICS. I wish to use the HTTPCli component in a multithreaded 
WO application to test the response from websites. Any thread within the 
WO application may use an HTTPCli object to make such a test.

WO My preferred approach would be: within a thread, create an HTTPCli object 
WO dynamically using the create method, and set the URL property. Then set 
WO handlers for onDocData, and onRequestDone and retrieve the page using the 
WO Get() function. Use an exception handler to trap any problem with Get().

WO - Do you see any potential problems with this, given that it will occur in 
a 
WO multithreaded environment?
WO - Are there any problems with having multiple HTTPCli objects running in 
WO multiple threads as described?
WO - Also, do I need to set the multithreaded property to true?

WO Thank you in advance for any assistance you can give.

WO Wilf

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


Re: [twsocket] HTTPCli in multithreaded application

2006-04-10 Thread Francois Piette
 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


Re: [twsocket] HTTPCli in multithreaded application

2006-04-10 Thread Wilfred Owen
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 twsocket@elists.org
To: ICS support mailing twsocket@elists.org
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


Re: [twsocket] HTTPCli in multithreaded application

2006-04-10 Thread Wilfred Owen
Hi Dod

I understand the point you are making. I intended to use the HTTPCli 
component as part of an existing application which already uses threads. The 
threads need to test response from websites as part of the other activities 
they carry out - this is why this approach seemed most natural to me, within 
the context of an existing application, although I appreciate if were 
starting from afresh there could be better approaches!

Thank you for taking the time to respond.

Wilf


From: Dod [EMAIL PROTECTED]
Reply-To: ICS support mailing twsocket@elists.org
To: ICS support mailing twsocket@elists.org
Subject: Re: [twsocket] HTTPCli in multithreaded application
Date: Mon, 10 Apr 2006 11:27:59 +0200

Hello Wilfred,

Main question is why use threads ? ICS main advantage is to work in
non threaded model, just create 10, 20, 30 instances of THHPCli and
connect them :-)

WO Hello

WO I am new to ICS. I wish to use the HTTPCli component in a multithreaded
WO application to test the response from websites. Any thread within the
WO application may use an HTTPCli object to make such a test.

WO My preferred approach would be: within a thread, create an HTTPCli 
object
WO dynamically using the create method, and set the URL property. Then set
WO handlers for onDocData, and onRequestDone and retrieve the page using 
the
WO Get() function. Use an exception handler to trap any problem with 
Get().

WO - Do you see any potential problems with this, given that it will occur 
in a
WO multithreaded environment?
WO - Are there any problems with having multiple HTTPCli objects running 
in
WO multiple threads as described?
WO - Also, do I need to set the multithreaded property to true?

WO Thank you in advance for any assistance you can give.

WO Wilf

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


Re: [twsocket] HTTPCli in multithreaded application

2006-04-10 Thread Arno Garrels
Wilfred Owen wrote:
 Hi Dod
 
 I understand the point you are making. I intended to use the HTTPCli
 component as part of an existing application which already uses threads.
 The threads need to test response from websites as part of the other
 activities they carry out - this is why this approach seemed most natural
 to me, within the context of an existing application, 

Of course it's no problem to run the THttpCli in threads as long as the
thread has a working message pump. However a thread per HTTP connection may
waste resources. Have you read these articles?
http://wiki.overbyte.be/wiki/index.php/Asynchronous_Paradigm
http://wiki.overbyte.be/wiki/index.php/FAQ.MultiThreading
(The wiki is still under construction but both articles may point
you to the right direction)

How many concurrent connections do you expect?

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
 

 although I
 appreciate if were starting from afresh there could be better approaches!
 



 
 Wilf
 
 
 From: Dod [EMAIL PROTECTED]
 Reply-To: ICS support mailing twsocket@elists.org
 To: ICS support mailing twsocket@elists.org
 Subject: Re: [twsocket] HTTPCli in multithreaded application
 Date: Mon, 10 Apr 2006 11:27:59 +0200
 
 Hello Wilfred,
 
 Main question is why use threads ? ICS main advantage is to work in
 non threaded model, just create 10, 20, 30 instances of THHPCli and
 connect them :-)
 
 WO Hello
 
 WO I am new to ICS. I wish to use the HTTPCli component in a
 multithreaded WO application to test the response from websites. Any
 thread within the WO application may use an HTTPCli object to make such
 a test. 
 
 WO My preferred approach would be: within a thread, create an HTTPCli
 object
 WO dynamically using the create method, and set the URL property. Then
 set WO handlers for onDocData, and onRequestDone and retrieve the page
 using the
 WO Get() function. Use an exception handler to trap any problem with
 Get().
 
 WO - Do you see any potential problems with this, given that it will
 occur in a
 WO multithreaded environment?
 WO - Are there any problems with having multiple HTTPCli objects running
 in
 WO multiple threads as described?
 WO - Also, do I need to set the multithreaded property to true?
 
 WO Thank you in advance for any assistance you can give.
 
 WO Wilf
 
 --
 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