Solved

Errors using CInternetFile for ftp transfer

Posted on 2004-08-13
4
510 Views
Last Modified: 2013-11-20
I have an application that connects to an ftp server and downloads *.zip files to the client.  I'm having some problems with users who use XP Home and have some sort of home network setup that shares a broadband connection.

I'm using CInternetSession to connect.  I use a direct connection for aol/compuserve users:
aol/compuserve users:  pDlg->m_dlgAutoUpdate.isess = new CInternetSession(NULL,1,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);

OR

regular users: pDlg->m_dlgAutoUpdate.isess = new CInternetSession



And CInternetFile to transfer the file:

    CInternetFile* pRemoteFile = pDlg->m_dlgAutoUpdate.pConn->OpenFile(tis->strFilename,
        GENERIC_READ, INTERNET_FLAG_NO_CACHE_WRITE | FTP_TRANSFER_TYPE_BINARY, tis->dwID);

    while(TRUE) {
       UINT nActual= pRemoteFile->Read(inBuf, 4096);
       fLocalFile.Write(inBuf, nActual);
       pDlg->m_dlgAutoUpdate.PostMessage(WM_USER_THREAD_UPDATE_DOWNPROGRESS,lCurProgress,0);
                  
       strMsg.Format("%d of %d KB", (lCurProgress / 1028), (tis->nFilesize / 1028));
       pDlg->m_dlgAutoUpdate.m_mKB.SetWindowText(strMsg);
               
       if(nActual != 4096)            // reached end of file!
       {
            pDlg->m_dlgAutoUpdate.PostMessage(WM_USER_THREAD_UPDATE_DOWNPROGRESS,tis->nFilesize,1);
            break;
       }
     }


On the problematic machines, the app connects OK to the server, but when the file transfer begins, they get a number of errors which stop the process:
- error 800: blah blah blah... consider using PASV
- error 426 ...Failure writing network stream...
- error 150 ...opening in binary mode...

No files are downloaded.  Anyone with suggestions?

Thanks,

MT
0
Comment
Question by:supertedusa
  • 2
4 Comments
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 11799077
i'm not sure
but following link may be of help
http://www.funducode.com/freevc/internet/internet5/internet5.htm
BOL
0
 

Author Comment

by:supertedusa
ID: 11809954
Thanks,  but that article only covers the basics and doesn't tell me anything new.

MT
0
 
LVL 2

Accepted Solution

by:
MikeAThon earned 500 total points
ID: 11835030
This might be a firewall issue.  PASV mode is a "passive" mode in the FTP protocol that is designed to circumvent difficulties caused by firewalls.  The PASV command requests the server-DTP to "listen" on a data port (which is not its default data port) and to wait for a connection, rather than initiate one upon receipt of a transfer command.  See RFC-959, "File Transfer Protocol" at http://www.ietf.org/rfc/rfc0959.txt

If it indeed is a firewall issue, I don't know how to solve it.  Sorry.  Maybe you can set your FTP connection to passive mode in CInternetSession::GetFtpConnection, by setting the bPassive parameter to TRUE

Regards,
Mike
0
 

Author Comment

by:supertedusa
ID: 11835805
I'll try the passive parameter and let you know if that works.  Thanks,

MT
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 124
Replacement selected text 2 58
ASCII Non-Printable characters/codes and their HTML equivalents 6 104
iSeries DB2 Query 2 89
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now