Solved

Errors using CInternetFile for ftp transfer

Posted on 2004-08-13
4
520 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

630 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