Download only first 5K of file.

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
Big Muscle
Posts: 72
Joined: 2004-01-23 14:45

Download only first 5K of file.

Post by Big Muscle » 2004-01-30 13:34

I added an item to popup menu on search result. I need if I click on this item, it will download only first 5K of file. Can you help me ???

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2004-01-30 13:45

The "View as text" menu item in the search results window already does something similar. You should have a look at that code for ideas.
The world is coming to an end. Please log off.

DC++ Guide | Words

Big Muscle
Posts: 72
Joined: 2004-01-23 14:45

Post by Big Muscle » 2004-01-30 13:48

I found tis line:

QueueManager::getInstance()->add(si->sr->getFile(), si->sr->getSize(), si->sr->getUser(), tgt + si->fileName);

I will try to change si->sr->getSize() to 5kB.

Twink
Posts: 436
Joined: 2003-03-31 23:31
Location: New Zealand

Post by Twink » 2004-01-30 17:24

interesting idea, is this for fake checking?

FarCry
Programmer
Posts: 34
Joined: 2003-05-01 10:49

Post by FarCry » 2004-01-30 18:52

Big Muscle wrote:I will try to change si->sr->getSize() to 5kB.

That won't work and there's no single-call solution to fit your needs.

Big Muscle
Posts: 72
Joined: 2004-01-23 14:45

Post by Big Muscle » 2004-01-31 03:55

It works. But if user don't have free slots, it writes "No Slots Available" and it don't use slots for small files.

I have made feature to extract info from MP3. It works very well. It downloads only 5 bytes of file insted of complete file.

FarCry
Programmer
Posts: 34
Joined: 2003-05-01 10:49

Post by FarCry » 2004-01-31 07:49

Big Muscle wrote:It works.

Tried a source with compressed transfers disabled or one that doesn't support it, like any non-dc++ client?

psf8500
Posts: 23
Joined: 2003-03-04 18:51
Contact:

Post by psf8500 » 2004-01-31 16:13

Twink wrote:interesting idea, is this for fake checking?

An idea similar to this was suggested to me a few days ago here as a feature request for my CDM.
My main concern with this was the no slots available problem that big muscle seems to be having.
Big Muscle wrote:But if user don't have free slots, it writes "No Slots Available" and it don't use slots for small files.

It's the remote client that decides if its a small file or not i guess, but if you can get it to work i'd be very interested :)

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-01-31 18:05

Big Muscle wrote:It works. But if user don't have free slots, it writes "No Slots Available" and it don't use slots for small files.


The file itself isn't small, although the segment you want is. If DC++ made the "small file" determination based on the requested section of a file, someone could easily get whole files off of you if they segmented their requests. ;-)

Locked