tags:

views:

61

answers:

1

Hi,

I am using CFtpConnection class for creating my FTPClient Library using MFC. I am using GetFile to download file from Server. MY requirement is like if i am downloading 100 MB video from server when 50-60 MB video is downloaded and in between if i play that while it should play upto that particular location what it has downloaded uptil that time .

Is that way i can do it any additional parameters i need to pass or something like that?

My FTPlibrary download method is as follows:

CFtpConnection* m_pConnect;
bool CFTPClient::Download(LPCTSTR pstrRemoteFile, LPCTSTR pstrLocalFile,
        DWORD dwFlags)
{
   m_pConnect->GetFile(pstrRemoteFile,pstrLocalFile,dwFlags); 
   return true;
}

And while calling in my application i am doing like this :

CFTPClient m_objftpclient ; 
m_objftpclient.Download("MVI_2884_1.avi","D:\\MVI_2884_1.avi",FTP_TRANSFER_TYPE_BINARY);
+1  A: 

You can't do that easily or even do it at all. The GetFile method of CFtpConnection is blocking which means it will exit only when the file is downloaded. So even if you thread it, the only way you can monitor the download is to get the size of the file on disk.

If you're about to implement video streaming, you should go down a level and work at the socket level. If you really want to use CFtpConnection, you should use the method OpenFile which returns a CInternetFile which can be read by chunks allowing you to monitor the download and share the buffer in which the file is downloaded for playback.

Eric Fortin