N
NutsAboutVB
Basically, the title explains it.
I want to be able to read the first n bytes (say, 1024 bytes) of any
file (text or binary) off the internet in my vb.net application. I
specifically do not want to download the whole file (which in most
cases will be significantly large compared to the portion i do want).
I've looked into system.net.webclients only to find that the
OpenReadAsync methods doesn't even have a ProgressChanged event, and
I've looked into DownloadDataAsync method only to find that there is
a DownloadProgressChanged event but it doesn't actually pass the
buffered data to anything (and so you can't grab the start of the data
and then cancel the remaining transfer). There is a
DownloadDataCompleted event which is fired if you cancel the transfer
prematurely, however, in cases where the transfer is cancelled or there
is a transfer error, NON of the data transfered is actually passed to
this function either (transfer must complete for you to be able to
access the data through the DownloadDataCompletedEventArgs.Result
argument).
This is really disappointing, you'd figure these issues would be
clearly documented (but they are not and it really is guess work +
trial & error with ms these days - still). If they can't document such
a comprehensive framework sufficiently, maybe they shouldn't provide
101 classes to download files where not one can be rendered into
downloading a partial file.
Ok, I've had my moment of publicly whining (this is what happens
after 3-full days of performing errant google searches).
Could anyone point me in the right direction? I'm sure it would be a
generally useful post since there is a lack of discussion of this
anywhere on the internet. Something like this could also be useful for
resumable downloads, resumable downloading especially in the area of
creating an application that would support this.
Kindly,
Ethan
I want to be able to read the first n bytes (say, 1024 bytes) of any
file (text or binary) off the internet in my vb.net application. I
specifically do not want to download the whole file (which in most
cases will be significantly large compared to the portion i do want).
I've looked into system.net.webclients only to find that the
OpenReadAsync methods doesn't even have a ProgressChanged event, and
I've looked into DownloadDataAsync method only to find that there is
a DownloadProgressChanged event but it doesn't actually pass the
buffered data to anything (and so you can't grab the start of the data
and then cancel the remaining transfer). There is a
DownloadDataCompleted event which is fired if you cancel the transfer
prematurely, however, in cases where the transfer is cancelled or there
is a transfer error, NON of the data transfered is actually passed to
this function either (transfer must complete for you to be able to
access the data through the DownloadDataCompletedEventArgs.Result
argument).
This is really disappointing, you'd figure these issues would be
clearly documented (but they are not and it really is guess work +
trial & error with ms these days - still). If they can't document such
a comprehensive framework sufficiently, maybe they shouldn't provide
101 classes to download files where not one can be rendered into
downloading a partial file.
Ok, I've had my moment of publicly whining (this is what happens
after 3-full days of performing errant google searches).
Could anyone point me in the right direction? I'm sure it would be a
generally useful post since there is a lack of discussion of this
anywhere on the internet. Something like this could also be useful for
resumable downloads, resumable downloading especially in the area of
creating an application that would support this.
Kindly,
Ethan