Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

InternetOpenUrl delay

Posted on 2005-05-04
9
Medium Priority
?
993 Views
Last Modified: 2013-12-03
I have an ActiveX control that uses InternetOpenUrl to download a file to display.  On one machine out of three that I've tested it on (all XP SP2, IE6, with the firewall turned off on the problem machine) there's a delay of around a minute and a half (though it varies) before InternetOpenUrl returns.  The CPU is busy and the network monitor icon in the tray claims that there is network traffic (but Ethereal says there isn't).  I've verified with the debugger that it's the call to InternetOpenUrl that's hanging.

The ActiveX control is hosted within an Internet Explorer control, which is in turn hosted within a Java application using Sun JRE 1.5.  The same URL works fine in a plain old Internet Explorer window.

I was originally passing INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_PASSIVE | INTERNET_FLAG_RESYNCHRONIZE as the dwFlags argument, but I've also tried passing zero and it made no difference.

Does anyone have any ideas about what could be causing the delay, or how I can diagnose the problem further?
0
Comment
Question by:RichieHindle
9 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 13926658
Could that be a DNS problem (that's a shot in the dark, though)?
0
 
LVL 14

Author Comment

by:RichieHindle
ID: 13926787
That was one of our first thoughts too, but the same URL works fine when the ActiveX control is embedded in an IE application window - it's only when the control is embedded in an IE embedded in the Java application that it goes wrong.  DNS really shouldn't account for that.  I'll try Ethereal again, watching just the DNS traffic this time, and see if anything shows up.
0
 
LVL 8

Expert Comment

by:_corey_
ID: 13927432
The very small amount of COM communication through Java I've seen did not have *that* big of a delay.

Is there some form of emulation going on anywhere you think?  Does anything else in that IE control behave akwardly?

This is even more of a useless shot in the dark, but I just had the thought of my experience.

corey
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
LVL 14

Author Comment

by:RichieHindle
ID: 13933656
jkr: I don't believe it's DNS that's the problem, for two reasons.  It behaves exactly the same way if you switch off the network and run the client and server on the same machine.  Also, when connected to the network, there is no DNS traffic at all - the URL is downloaded through a proxy, whose address is already in the DNS cache because it gets used for all HTTP traffic.

_corey_: I'm not sure what you mean by 'emulation', but no, the control works quite sensibly once it's downloaded the file.  It's only InternetOpenUrl that isn't working as normal.
0
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 2000 total points
ID: 13937796
Run a debug wininet.dll on this and get a debug log,  You'll be able to see what's happening.  InternetOpenUrl() is a wininet.dll command.  All windows Inet stuff is via wininet.dll.

Here's the how-to:
http://support.microsoft.com/default.aspx?scid=kb;en-us;884931

You can get the latest debug wininet from:

  ftp://ftp.microsoft.com/PSS/Tools/Developer%20Support%20Tools/WinInet/

it's simpler to put the wininet.dll in your \program files\internet explorer directory.  Then, create a zero-byte file called iexplore.exe.local right there.  Then, do as the article states.  You'll get the log file in the \program files\internet explorer directory,

Once you do that, repro the problem with logging enabled.  You'll see the delay in the log.  That'll help you narrow down the problem.

On a side note, I'm doing a similar thing with a .NET control hosted in Internet Explorer and it's instantaneous.  I'm using:

myOpen = InternetOpen(userAgent, INTERNET_OPEN_TYPE_PRECONFIG, null, null, 0);
myOpenUrl = InternetOpenUrl(myOpen, striPath, null, 0, INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_SECURE, ref dwContext);

0
 
LVL 14

Author Comment

by:RichieHindle
ID: 13937820
Dan7el: Thanks for the excellent suggestion - I'll try it ASAP (which will be tomorrow).
0
 
LVL 14

Author Comment

by:RichieHindle
ID: 13944577
Dan7el: Great advice!  I wasn't aware of the debug wininet.dll - very useful.

Sadly it wasn't a lot of help this time, because all it shows is the HTTP request being sent down the socket to the server, then a long delay, then the response being received.  That implies that the delay is at the server side, but then why would it only go wrong when embedded in Java and not when done directly from IE?  The HTTP headers and suchlike are all identical.

We currently have the client and server on the same Windows box.  We're going to try connecting to the same server software running on a Linux box, to see whether that shines any light on things.
0
 
LVL 20

Expert Comment

by:Daniel Van Der Werken
ID: 13948964
Get Ethereal from http://www.ethereal.com and "sniff" the network connection in conjunction with the wininet.dll log.  As long as it's not SSL, you should be able to match up the HTTP and network traces.  Then, look to see what the server is sending back to you per TCP/IP.  Maybe you're getting some strange socket behavior.  
0
 
LVL 14

Author Comment

by:RichieHindle
ID: 13994722
I've now got to the bottom of this, and it's rather embarrassing.  The problem was some busy-waiting code in the ActiveX control that was hammering the machine, making the server (which was running on the same machine) go very slowly serving the content.  I still don't know why it only went wrong in the Java application and not in IE, but getting rid of the busy-wait loop solved the problem.

Thanks for all the ideas - especially to Dan7el for drawing my attention to the debug wininet.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

581 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