Solved

Errors using CInternetFile for ftp transfer

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Complete beginner needs help making a cron job 9 134
pre4 challenge 19 116
abstract class with all non abstract mentods 6 87
fix34  challenge 9 182
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 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