Download File chunks - WeOnlyDo Discussion board

Download File chunks (wodFTPServer)

by Bernd, Saturday, November 11, 2006, 22:10 (6368 days ago)

Hi,

I want to allow the download of file chunks by supporting special filenames. If I would request BigFile.dat:4096:8191 I want to send the 4K Block starting at offset 4096 of BigFile.dat to the client. Can this be done with your FTPServer component?

Bernd

Re: Download File chunks

by wodSupport, Saturday, November 11, 2006, 23:17 (6368 days ago) @ Bernd

Bernd,

hi. Unfortunatelly, FTP protocol doesn't support that, so no client nor the server will make it the way you need.

But.. In theory.. You could let your client send REST command to continue at specific position, and then after it receives enough data to send ABOR command - so you get part of the file you need. But it's up to your client to do that.


As for SFTP protocol - any client could do this for you.

Hope I helped.
Kreso

Re: Download File chunks

by Bernd, Friday, November 17, 2006, 17:22 (6362 days ago) @ wodSupport

Kreso,

thank you for your answer.


hi. Unfortunatelly, FTP protocol doesn't support that, so no client nor the server will make it the way you need.

But.. In theory.. You could let your client send REST command to continue at specific position, and then after it receives enough data to send ABOR command - so you get part of the file you need. But it's up to your client to do that.

Of course the standard FTP protcol does not support that. I would implement both the client and the server portion. The server should behave like any standard FTP server to regular FTP clients but should also allow sending data chunks to the client when a special request is received.

I think it could be easily done if you allow to redirect requests to some sort of virtual files. I read the doc's and realized that I can redirect to an arbitrary file but when using this mechanism I had to copy each chunk before transferring. So the main question is if there is a way to replace the file stream functions you use.

So what do you think?

Bernd

Re: Download File chunks

by wodSupport, Friday, November 17, 2006, 17:29 (6362 days ago) @ Bernd

Bernd,

would FileTransferData help?

http://www.weonlydo.com/FTPServer/Help/wodFTPDLib~wodFTPD~FileTransferData_EV.html

I think you can feed it the way you need?

Kreso

Re: Download File chunks

by Bernd, Monday, November 20, 2006, 12:54 (6359 days ago) @ wodSupport

Kreso,


would FileTransferData help?

http://www.weonlydo.com/FTPServer/Help/wodFTPDLib~wodFTPD~FileTransferData_EV.html

I think you can feed it the way you need?

I don't think it will work since it FIRST reads the data and the allows me to modify the data. If you'd implement another callback to FEED the data, it should work. You may also think about some more generic support of virtual files. So one could get SHA-1 checksums from files by retrieving SHA1:filename.ext for example.

I am thinking of an alternate way to use your WebServer component since this component can feed any data as desired. At least as far as I unterstood.

Bernd

Re: Download File chunks

by wodSupport, Monday, November 20, 2006, 13:26 (6359 days ago) @ Bernd

Bernd,

but I think you could have, for example, 1-byte file and then in the event change that 1-byte array to *anything* else - a bit strange approach but will work.

As for SHA1.. Hmm.. If we would implement something like that (which isn't any standard btw) which command exactly would you use to obtain it?

With little tweaks you cuold do it too btw - you could intercept DownloadFile event, check if SHA1 exists in the name and return different error?

Kreso

Re: Download File chunks

by Bernd, Monday, November 20, 2006, 15:23 (6359 days ago) @ wodSupport

Kreso,

okay, this should work but is a little bit ugly . :-)

The SHA-1 was just an example. I thought of extending a standard protocol (FTP) to support some special behaviour. What I want to develop ist a file-sync application which works over FTP and/or HTTP to sync two directories. So to check if two files area identical I need to retrieve some information about them. This could be the time stamp or for example the SHA-1 checksum. I thought of handling all this with special filenames:

FTP request test.txt -> Get test.txt content
FTP request SHA1:test.txt -> Get SHA-1 string of test.txt
FTP request test.txt:2000:3000 -> Get byte 2000-3000 of test.txt

If you'd implement the possibility to replace the standard file stream this could be easily done. It my be sufficient to implement an IFtpFile interface with some member functions: GetFileSize(), ReadFile(nStartPos, nCountBytes), ... Any function could pass to the original function if no special functionality is required.

This way out FTP server would work as any standard FTP server but has an extension for or own client. There should not be any compatibilty issues here.

Bernd

Re: Download File chunks

by wodSupport, Monday, November 20, 2006, 16:22 (6359 days ago) @ Bernd

Why not sending something like

SITE SHA1 /path/to/file

command? You can catch that easily in Site event and return reply back.

why don't you try that? This is regular mechanism.

Kreso

Re: Download File chunks

by Bernd, Monday, November 20, 2006, 16:32 (6359 days ago) @ wodSupport

Kreso,

this may work for a SHA-1 checksum, but will probably not work with sending file data.

Is it so complicated to do the stream replacement stuff? We would for sure license FtpServer if this was implemented. :-)

Right now we own HttpDlx and think about FtpServer, WebServer and later SSHpackage.

Bernd

Re: Download File chunks

by wodSupport, Monday, November 20, 2006, 16:35 (6359 days ago) @ Bernd

Stream? What is stream in ActiveX world? IStream interface?

Hmm..

So like we have VirtualFolders, you would expect to have VirtualFiles too - which you cuold point to real files, or to IStream interface. Is this how you see it? (btw I'm not promising anything yet, just giving out ideas and discussing it)

Kreso