Question : VB.NET problem using WebRequest.GetResponseStre<wbr />am to download a big file in GRPS/3G

Any Experts Please Help!
I am using the following VB code in Window Mobile to download a 1M file from the web server.  It works very fast on Wi-Fi mode, less than 5 seconds, using my code or Internet Explorer, no discernable different.    
However, on GPRS/3G mode: it takes about 5 to 10 minutes to download the same file in IE, but my VB code took 17 or sometime 40 minutes to download the file.  The first 500K seems fast in about 4 minutes, still a bit slow when compare to IE, but the last 500 was so slow.  What am I missing?  Please help.  Thanks!
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Request = System.Net.WebRequest.Create(sURL)
            Response = Request.GetResponse
            ResponseStream = Response.GetResponseStream
            Dim numBytesToRead As Integer = CInt(Response.ContentLength)
            Dim bytes(Response.ContentLength) As Byte
            Dim numBytesRead As Integer = 0
            While numBytesToRead + 1 > 0
                Dim n As Integer = ResponseStream.Read(bytes, numBytesRead, numBytesToRead)
                 If n = 0 Then
                    Exit While
                End If
                numBytesRead += n
                numBytesToRead -= n
            End While

Answer : VB.NET problem using WebRequest.GetResponseStre<wbr />am to download a big file in GRPS/3G

I changed the code to read 2K at a time and it is doing the same things......

my code was doing the opposite of what CodeCruiser suggested, it was reading the full file size, then the remaining........ until the full file is done!  
Random Solutions  
 
programming4us programming4us