// JP opened flex table

Click to See Complete Forum and Search --> : HINTERNET safe for multithreading ?


hspc
April 16th, 2004, 07:20 AM
Hi
are HINTERNET handles safe for multithreading ?
can i pass handles returned from InternetConnect or InternetOpen to many threads ? (in the CreateThread API)
what about windows handles in general ?
thank you in advance :)

Andreas Masur
April 16th, 2004, 07:40 AM
Well...a handle itself cannot be multithreaded on its own since it is basically a simple datatype. However, I think you want to know whether you can use the same connection within different threads.

May I first ask what you are trying to accomplish? In other words, why would you like to pass this connection to several threads?

hspc
April 16th, 2004, 11:02 AM
Hi
thank you for replying
I think you want to know whether you can use the same connection within different threads.
yes this is what i want to do.

I read in a MSDN article that it's better to create 1 session using inInternetOpen and reuse it. And I thought it's the same for InternetConnect since i'll access the same server.

But i also read in another MSDN article that each thread should create it's own CInternetSession and CInternetConnection (I'm not using MFC but the concept is the same)

I prefer to have each thread create it's own session and connection if this won't affect peformance.

any suggestions ?:rolleyes:

Andreas Masur
April 16th, 2004, 03:03 PM
Originally posted by hspc
any suggestions ?:rolleyes:
Well...I would also rather use a separate connection instead of sharing one throughout the system. I haven't dealt with this 'CInternetSession' that much, however, I would not see any reason why having multiple should decrease the performance of your application. I would rather see a decreasage due to a limited server... :cool:

hspc
April 16th, 2004, 03:56 PM
seems that i'll share the session. and use multiple connections !!
more suggestions ?

Andreas Masur
April 16th, 2004, 04:06 PM
Originally posted by hspc
more suggestions ?
No...not at this time... :cool:

//JP added flex table