473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HowTo, Download first 1024 bytes of file ONLY?

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

Mar 27 '06 #1
0 1192

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
0
by: Tim Cowan | last post by:
Hi, I am using this code to download files on VS 2005. It downloads the file but waits until the timeout (which is why it is so short) to add the last 4 bytes or so. It always returns a...
0
by: NutsAboutVB | last post by:
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...
1
by: Harold | last post by:
Hi, I'm writing software which should download some files. I want to limit the number of simultanioulsy downloads to two. I'm using the ServicePointManager object for this. But I still can...
3
by: Bouffa | last post by:
Hello everyone, I suppose you all know force-download scripts. The problem is that these scripts don't allow files to be splitted when downloading them via a download manager. I've found a...
0
by: jinnareddy | last post by:
Hi, I'm unable to download a file that is having a 2-byte char in its name (e.g.テ) using force download option. Though, am able to download file names involving ASCII chars. I have tried URL...
10
by: =?Utf-8?B?SnVhbg==?= | last post by:
Hi! I want to use ASP to download big files using ADODB.STREAM. It works very fine with files smaller than 80 MB. On the Webserver I can see that memory allocation and the process w3wp is...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.