Solved

Wininet & multithreaded

Posted on 1997-06-13
8
517 Views
Last Modified: 2013-12-03
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

thanks
Moshe
0
Comment
Question by:moshem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1398281
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.
0
 
LVL 1

Author Comment

by:moshem
ID: 1398282
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

thanks
0
 
LVL 1

Author Comment

by:moshem
ID: 1398283
Adjusted points to 150
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Expert Comment

by:dtowell
ID: 1398284
My guess is that WinINet is conpletely nonthreadaware, meaning you will need to synchronize access yourself.
0
 
LVL 1

Author Comment

by:moshem
ID: 1398285
Sorry , but I refer you to the WinInet SDK to a specific
paragraph that specifies that wininet is multitheaded ready!
0
 
LVL 3

Accepted Solution

by:
vinniew earned 150 total points
ID: 1398286
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.
0
 
LVL 1

Author Comment

by:moshem
ID: 1398287
what do you mean by "Be sure to specify different port addresses for each connection that's outbound.." , what is that in
wininet API
0
 
LVL 3

Expert Comment

by:vinniew
ID: 1398288
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.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Launching Internet Explorer inPrivate mode using VBA 14 558
How Does Quick Books store date / time? 3 109
Dialogbox API leak? 18 108
Licensing Sharepoint 2016 for developers 11 75
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question