Solved

Errors using CInternetFile for ftp transfer

Posted on 2004-08-13
4
509 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 147
wait notify demo infinite loop 3 80
haveThree challenge 22 100
Fibonacci challenge 11 82
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

14 Experts available now in Live!

Get 1:1 Help Now