Sunday, March 1, 2009

Wininet Timeout Issue and Solution


The WinInet API provides access to the common Internet application-layer protocols HTTP, FTP, and Gopher. With this API you can add the ability to access Internet resources to both new and existing Windows applications. The API provides control over each step of a transaction and provides the means to read and writes files.



WinInet has a bug in setting TIMEOUT value when the client send request to initialize a connection. The bug is when you use InternetSetOption to set up timeout value, e.g. 30seconds. The timeout value does not work. The client doesn't timeout until default timeout runs up.



One solution give by Microsoft is to create second thread to watch for the connection request. The second request will kill the main connection request if it doesn't receive response from server in the timeout set. Here is the article - How To Control Connection Timeout Value by Creating Second Thread


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home