DownloadFile problem

sora1984

New member
Joined
Aug 25, 2013
Messages
2
Programming Experience
Beginner
Hi I'm working an a patch application for a game we play, the code I have to read the version reads from a text file to get the URL
I have it in a config file so people can use the patcher for their game server also. (hope this is in the correct section)

config
VB.NET:
PatchUrl=http://example.com/patchfolder/
ServerKey=blahblah

download patch section
Private Sub Downloader_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles Downloader.DoWork

            Dim http As String = IO.File.ReadAllLines(Path & "\config")(0)
            Dim httpx As String
            Dim CLIENT As String = IO.File.ReadAllLines(Path & "\version")(0)
            Dim CLIENTVER As String
            CLIENTVER = CLIENT.Remove(0, 9)
            httpx = http.Remove(0, 9)
            Dim patch As String
            patch = CLIENTVER + 1
            link = httpx & patch & ".zip"
            Dim size As Integer
            Dim wr As WebRequest
            wr = WebRequest.Create(link)


            Dim webr As WebResponse = wr.GetResponse
            size = webr.ContentLength
            size = size / 1024 / 1024
            ProgressBar3.Maximum = size
            Label4.Text = "Download Size " & size & " MB"
            Dim wc As New WebClient


            wc.DownloadFile(link, Path & "\" & patch & ".zip")


Everything works fine its just the the section "wc.DownloadFile(link," doesn't like me using link, (operation times out) but works if I type the exact URL there.
Any ideas as to why I'm still learning but I'm kinda stuck now.

Thank you for any feedback

Regards.
 
Last edited by a moderator:
Presumably 'link' doesn't contain the correct value. Have you checked what it actually contains or are you just assuming that your code works even though it doesn't work.
 
I can show the value of (link) within a label just wont go through with the download part


jmcilhinney, I figured it out... just missed closing a web request simple as that been looking at that all morning hehe


[Resolved]

Thanks
 
Last edited:
Back
Top