Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timeout Error using DownloadFile() Function

Status
Not open for further replies.

txmed

Programmer
Mar 23, 2006
65
0
0
US
Greetings. I'm an using the Network.DownloadFile() function to download a XML file from the web. The file downloads fine from my development machine, but when a customer of mine tries to do it (from a different network) it fails the very first time. However, if the user tries to download the file again, it works that time and every time afterwards.

Does anyone know what might be causing this problem? I noticed that the DownloadFile() function errors out the 1st time the app runs, but then works every time afterwards. It the app is stopped and then restarted, it errors out again the 1st time and then works afterwards.

The customer is getting a Time Out error message.

Here is the code I'm using:
Code:
My.Computer.Network.DownloadFile("[URL unfurl="true"]http://www.mysite.com/test.xml",[/URL] "C:\test.xml", "", "", False, 500, True)

(txmed)
 
You have the time out set to less than a second. You might try increasing it. 500 is less than a second 5000 is 5 seconds. The defaul is recommended at 100 seconds (100000) so I would just leave it blank actually.

-I hate Microsoft!
-Forever and always forward.
 
That's really strange an example the give is 500 milliseconds. That seems really strange. I would still suggest increasing the time out. Microsoft is filled with a bunch of Fruit Loops anyway.

-I hate Microsoft!
-Forever and always forward.
 
I know, its very weird. I went ahead and increased the time out interval to 1000, and then I placed the DownloadFile() function into a For Loop. I figured that it fails the 1st time, but then works every time afterwards. I've placed the code into a For Loop that tries to download it 3 times. If it passes either of the time, then it exits the loop. If it fails every time, then I give the user the appropriate error message.

I'll have my customer try it out to see if it works.

(txmed)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top