Discussion:
does INTERNET_OPTION_CONNECT_TIMEOUT work or not?
(too old to reply)
Joe
2004-12-28 03:23:28 UTC
Permalink
Hi,

I've read that
INTERNET_OPTION_CONNECT_TIMEOUT

never used to work but does now, however I can't get it functioning. I've
downloaded and compiled the MS TEAR example

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/_sample_mfc_tear.asp

and added

BOOL bret=session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,0);

after AfxParseURL (line 212).



Would someone confirm whether it works and if so please post some code
amendments to confirm that
I can get it working on my machine?

I have 6.0.2800.1405 of wininet.dll

Thanks
Brian Combs
2004-12-31 15:03:51 UTC
Permalink
Hello
The answer is yes and no.
176420 BUG: InternetSetOption Does Not Set Timeout Values
http://support.microsoft.com/?id=176420

For IE 6.x the different timeout settings should be all fixed for HTTP
however FTP may still fail. Also be aware that this is only connnect
timeout and you should also set the other timeout settings.
INTERNET_OPTION_CONNECT_TIMEOUT
INTERNET_OPTION_RECEIVE_TIMEOUT
INTERNET_OPTION_SEND_TIMEOUT

I also don't know if MFC is doing anything that is keeping from being set
correctly. You can use debug build of WinInet to get a trace and see what
is happeing.,

884931 How to use the debug version of the Wininet.dll file for Internet
http://support.microsoft.com/?id=884931

Thanks
Brian [MSFT]
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Joe" <***@home.com>
| Newsgroups: microsoft.public.inetsdk.programming.wininet
| Subject: does INTERNET_OPTION_CONNECT_TIMEOUT work or not?
| Date: Tue, 28 Dec 2004 03:23:28 -0000
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| Lines: 32
| Message-ID: <41d0d1b0$0$19158$***@news-text.dial.pipex.com>
| NNTP-Posting-Host: 81-86-229-91.dsl.pipex.com
| X-Trace: 1104204209 news-text.dial.pipex.com 19158 81.86.229.91:4157
| X-Complaints-To: ***@uk.uu.net
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fastwebnet.it!tiscali!new
sfeed1.ip.tiscali.net!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsoutp
eer01.lnd.ops.eu.uu.net!lnewsinpeer01.lnd.ops.eu.uu.net!bnewsoutpeer01.bru.o
ps.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!bnewspost00.bru.ops.eu.uu.net!e
mea.uu.net!not-for-mail
| Xref: cpmsftngxa10.phx.gbl
microsoft.public.inetsdk.programming.wininet:11940
| X-Tomcat-NG: microsoft.public.inetsdk.programming.wininet
|
| Hi,
|
| I've read that
| INTERNET_OPTION_CONNECT_TIMEOUT
|
| never used to work but does now, however I can't get it functioning. I've
| downloaded and compiled the MS TEAR example
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/
html/_sample_mfc_tear.asp
|
| and added
|
| BOOL bret=session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,0);
|
| after AfxParseURL (line 212).
|
|
|
| Would someone confirm whether it works and if so please post some code
| amendments to confirm that
| I can get it working on my machine?
|
| I have 6.0.2800.1405 of wininet.dll
|
| Thanks
|
|
|
|
|
|
|
|
Joe
2005-01-02 14:23:24 UTC
Permalink
"Brian Combs" <***@online.microsoft.com> wrote in message news:a%***@cpmsftngxa10.phx.gbl...

Hi Brian.
Post by Brian Combs
Hello
The answer is yes and no.
176420 BUG: InternetSetOption Does Not Set Timeout Values
http://support.microsoft.com/?id=176420
For IE 6.x the different timeout settings should be all fixed for HTTP
Yes, as I said I have 6.0.2800.1405 of wininet.dll installed iexplorer
6.0.2800.1106
Post by Brian Combs
however FTP may still fail. Also be aware that this is only connnect
timeout and you should also set the other timeout settings.
INTERNET_OPTION_CONNECT_TIMEOUT
INTERNET_OPTION_RECEIVE_TIMEOUT
INTERNET_OPTION_SEND_TIMEOUT
Yes, thanks for that, I hadn't added these other two timeouts.
Sometimes it seems to work, othertimes not (I don't *think* its down to the
server response) and I can't effect the INTERNET_OPTION_CONNECT_TIMEOUT
default value - it times out after just over 20 secs regardless of any value
I set.
Post by Brian Combs
I also don't know if MFC is doing anything that is keeping from being set
correctly. You can use debug build of WinInet to get a trace and see what
is happeing.,
884931 How to use the debug version of the Wininet.dll file for Internet
http://support.microsoft.com/?id=884931
OK I'll try and decipher it, but as a shortcut, would you post or direct me
to any code - as rudimentary as you like that actually *does* enact all the
timeouts (pref C/C++)?

Also, how can I set up a harness to test the INTERNET_OPTION_RECEIVE_TIMEOUT
and INTERNET_OPTION_SEND_TIMEOUT timeout options?

Its easy to test the INTERNET_OPTION_CONNECT_TIMEOUT as I just point to a
site thats down, but I can't work out how to simulate slows responses for
send and receive.

TIA
Joe
2005-01-02 19:24:22 UTC
Permalink
Post by Brian Combs
Hello
The answer is yes and no.
176420 BUG: InternetSetOption Does Not Set Timeout Values
http://support.microsoft.com/?id=176420
For IE 6.x the different timeout settings should be all fixed for HTTP
however FTP may still fail. Also be aware that this is only connnect
timeout and you should also set the other timeout settings.
INTERNET_OPTION_CONNECT_TIMEOUT
INTERNET_OPTION_RECEIVE_TIMEOUT
INTERNET_OPTION_SEND_TIMEOUT
I also don't know if MFC is doing anything that is keeping from being set
correctly. You can use debug build of WinInet to get a trace and see what
is happeing.,
884931 How to use the debug version of the Wininet.dll file for Internet
http://support.microsoft.com/?id=884931
It doesn't provide any information on how to replace the wininet.dll with
the debug version.
I can't do so, as it is protected by Windows file protection and if I
reboot in safe mode I get a program is currently in use message.

Any ideas?

Thanks
Joe
2005-01-03 03:17:01 UTC
Permalink
Post by Joe
Post by Brian Combs
Hello
The answer is yes and no.
176420 BUG: InternetSetOption Does Not Set Timeout Values
http://support.microsoft.com/?id=176420
For IE 6.x the different timeout settings should be all fixed for HTTP
however FTP may still fail. Also be aware that this is only connnect
timeout and you should also set the other timeout settings.
INTERNET_OPTION_CONNECT_TIMEOUT
INTERNET_OPTION_RECEIVE_TIMEOUT
INTERNET_OPTION_SEND_TIMEOUT
I also don't know if MFC is doing anything that is keeping from being set
correctly. You can use debug build of WinInet to get a trace and see what
is happeing.,
884931 How to use the debug version of the Wininet.dll file for Internet
http://support.microsoft.com/?id=884931
It doesn't provide any information on how to replace the wininet.dll with
the debug version.
I can't do so, as it is protected by Windows file protection and if I
reboot in safe mode I get a program is currently in use message.
Any ideas?
Thanks
Also what will the debug trace tell me?

I have done a setoption with th enew timeout values, then a queryoption
which returns the correct value.

What else should I look for?

Thanks.
Stephen Sulzer
2005-01-03 10:28:16 UTC
Permalink
Brian,

Are you sure that the Connect timeout works fully in WinInet? I am very
doubtful. In particular, I am pretty sure that the Connect timeout does not
work for synchronous HTTP requests, including in IE6 SP1. Was it fixed for
XP SP2 perhaps? The bug with the Connect timeout is not in
InternetSetOption, but in the core WinInet HTTP stack.

Also, I doubt a WinInet debug log will help with this problem.

Joe: in your testing, do not use a value of zero for the Connect timeout
(just in case it gets reinterpreted as a "special" value, namely INFINITE).
Try a small non-zero value instead, like 5 (for 5 milliseconds).

Stephen
Post by Brian Combs
Hello
The answer is yes and no.
176420 BUG: InternetSetOption Does Not Set Timeout Values
http://support.microsoft.com/?id=176420
For IE 6.x the different timeout settings should be all fixed for HTTP
however FTP may still fail. Also be aware that this is only connnect
timeout and you should also set the other timeout settings.
INTERNET_OPTION_CONNECT_TIMEOUT
INTERNET_OPTION_RECEIVE_TIMEOUT
INTERNET_OPTION_SEND_TIMEOUT
I also don't know if MFC is doing anything that is keeping from being set
correctly. You can use debug build of WinInet to get a trace and see what
is happeing.,
884931 How to use the debug version of the Wininet.dll file for Internet
http://support.microsoft.com/?id=884931
Thanks
Brian [MSFT]
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Newsgroups: microsoft.public.inetsdk.programming.wininet
| Subject: does INTERNET_OPTION_CONNECT_TIMEOUT work or not?
| Date: Tue, 28 Dec 2004 03:23:28 -0000
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| Lines: 32
| NNTP-Posting-Host: 81-86-229-91.dsl.pipex.com
| X-Trace: 1104204209 news-text.dial.pipex.com 19158 81.86.229.91:4157
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fastwebnet.it!tiscali!new
sfeed1.ip.tiscali.net!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsoutp
eer01.lnd.ops.eu.uu.net!lnewsinpeer01.lnd.ops.eu.uu.net!bnewsoutpeer01.bru.o
ps.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!bnewspost00.bru.ops.eu.uu.net!e
Post by Brian Combs
mea.uu.net!not-for-mail
| Xref: cpmsftngxa10.phx.gbl
microsoft.public.inetsdk.programming.wininet:11940
| X-Tomcat-NG: microsoft.public.inetsdk.programming.wininet
|
| Hi,
|
| I've read that
| INTERNET_OPTION_CONNECT_TIMEOUT
|
| never used to work but does now, however I can't get it functioning. I've
| downloaded and compiled the MS TEAR example
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/
Post by Brian Combs
html/_sample_mfc_tear.asp
|
| and added
|
| BOOL bret=session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,0);
|
| after AfxParseURL (line 212).
|
|
|
| Would someone confirm whether it works and if so please post some code
| amendments to confirm that
| I can get it working on my machine?
|
| I have 6.0.2800.1405 of wininet.dll
|
| Thanks
|
|
|
|
|
|
|
|
Joe
2005-01-03 11:12:52 UTC
Permalink
Post by Stephen Sulzer
Brian,
Are you sure that the Connect timeout works fully in WinInet? I am very
doubtful. In particular, I am pretty sure that the Connect timeout does not
work for synchronous HTTP requests, including in IE6 SP1. Was it fixed for
XP SP2 perhaps? The bug with the Connect timeout is not in
InternetSetOption, but in the core WinInet HTTP stack.
Also, I doubt a WinInet debug log will help with this problem.
Joe: in your testing, do not use a value of zero for the Connect timeout
(just in case it gets reinterpreted as a "special" value, namely INFINITE).
Try a small non-zero value instead, like 5 (for 5 milliseconds).
Stephen
Hi Stephen,

Well , I've tried basically everything.
I've removed the MFC. I've tried an InternetSetOption with 0, 10,100 etc
etc.
I've placed in on each and every HINTERNET handle etc etc ect.

Nothing works. It *always* times out after 20 seconds. I have been able to
get the other 2 timeouts working intermittently.
INTERNET_OPTION_RECEIVE_TIMEOUT & INTERNET_OPTION_SEND_TIMEOUT.

But how can I set up a scenario where I can connect but the request fails so
I can test them fully?

Interestingly, If I InternetQueryOption without making any adjustments it
returns 300000 (30 secs) yet the timeout is always after 20!!!!
So something else is at play.

Also, I have read that the cancelling thread MS fix,
http://support.microsoft.com/kb/224318/EN-US/ will cancell all threads
currently accessing the Internet - so this is not an option, and its dirty
anyway.

Does timeout processing work OK with asynchronous requests?

Looks like it may be the only option.

I've spend *ages* on this - and I have read posts indicating there has been
this same bug going back 5 or more years (hence the thread title).

If the bug is *still* there..........

I'm pretty pissed off to put it mildly!!!!!!!!

Cheers
Brian Combs
2005-01-04 23:10:25 UTC
Permalink
This post might be inappropriate. Click to display it.
Joe
2005-01-05 04:25:15 UTC
Permalink
Post by Brian Combs
Hello
Based on Stephen's post I went and took a look at some old bug reports and
found he is correct. They never fixed INTERNET_OPTION_CONNECT_TIMEOUT as
the timeout is imposed by winsock layer.
Hmmpffhh!!

Thanks anyway.

Loading...