Wininet & multithreaded

I wrote a class that uses wininet to implemenet FTP session ,
but I need to have 5-6 objects of the same class running
simultaniasly , as a one thread program it did the job
perfectly , but when trying to have multiple threads , I had
many problems , ranging from unknown phenomenas to some
wierd things , like InternetConnect get stuck or only returns after 60 seconds and reporting a TIMEOUT , while
I know for sure that the destination is reachable , I know
that some function in Wininet need to be synchronized for
multithreaded operations , but which ones and how ? there
is nothing in MS documentation , plus if you know a good
disscusion forums or a tutorial ( more serious then MS documents) let me know

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MFC 4.2 and later have some classes that implement FTP session using Wininet functions. They are CInternetSession, CInternetConnection, CFtpConnection, CFtpFileFind, ... I think you can refer to the source code to find out how to do it.
moshemAuthor Commented:
Thanks for the pointer , but I really can't spend the time digging throu the huge MFC classes , I need a reliable answer withouth that overhead , please try to answer within the Win32
SDK boundaries

moshemAuthor Commented:
Adjusted points to 150
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

My guess is that WinINet is conpletely nonthreadaware, meaning you will need to synchronize access yourself.
moshemAuthor Commented:
Sorry , but I refer you to the WinInet SDK to a specific
paragraph that specifies that wininet is multitheaded ready!
WinInet compiles down to using asynchronous sockets.  I would suggest that you probably made the error yourself.  Be sure to specify different port addresses for each connection that's outbound, because the data channel will come back and look for it.  If it's busy with other data, it will get confused.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
moshemAuthor Commented:
what do you mean by "Be sure to specify different port addresses for each connection that's outbound.." , what is that in
wininet API
in FTPConnect you can specify port number.  That's a good starting point.  I looked through the inet.cpp class and MS doesn't worry about port numbers.  I'm not totally sure why.  I'm accustomed to doing all this with Winsock, because I have more control.  In Winsock, you connect(), bind() , send a command, recv().  Have you tried using the MFC classes to do this yet?  They may have support for multiple threads built in.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.