各位大侠:
    遇到一问题!
    设置ftp当前目录(结果返回显示设置成功)
    ......
    CFtpFileFind *pFtpFind=NULL;
    pFtpFind=new CFtpFileFind(p->m_pFtpConnection,1);
    BOOL bWorking=pFtpFind->FindFile((_T("*")));    上面代码在局域网用于查找ftp某目录下文件可以得到,但当用于广域网时(其实也就是一个房间的两个不同网外IP),运行到BOOL bWorking=pFtpFind->FindFile((_T("*")))死掉,所有其他代码的显示该ftp连接是成功的,就是在查找目录文件时就运行不下去,为什么?望各位大侠指点,在线等!
    谁首先解决,送分100!略表心意!呵呵!

解决方案 »

  1.   

    本人在应用程序导向生成的对话框中如下做成功。
    #include <afxinet.h>
    void CZxydlgDlg::OnButton5() 
    {
    // TODO: Add your control notification handler code here
       CInternetSession sess(_T("MyProgram/1.0"));
       CFtpConnection* pConnect = NULL;
       try
       {
          // Request a connection to ftp.microsoft.com. Default
          // parameters mean that we'll try with username = ANONYMOUS
          // and password set to the machine name @ domain name
          pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com"));      // use a file find object to enumerate files
          CFtpFileFind finder(pConnect);
          // start looping
          BOOL bWorking = finder.FindFile(_T("*"));
          if (bWorking)
          {
             bWorking = finder.FindNextFile();
             AfxMessageBox(finder.GetFileURL());
             bWorking = finder.FindNextFile();
             AfxMessageBox(finder.GetFileURL());
          }   }
       catch (CInternetException* pEx)
       {
          TCHAR sz[1024];
          pEx->GetErrorMessage(sz, 1024);
          printf("ERROR!  %s\n", sz);
          pEx->Delete();
       }   // if the connection is open, close it
       if (pConnect != NULL)
          pConnect->Close();
       delete pConnect;}以上代码实际为CFtpFileFind帮助里的代码。
      

  2.   

    本人的计算机是通过局域网上网的。
    如上运行结果为:
    ftp://ftp.micfosoft.com/bussys
    ftp://ftp.microsoft.com/deskapps
      

  3.   

    从ftp服务器下载目录时,在用InternetFindNextFile遍历文件并调用ftpgetfile下载过程中,下载目录中第一个文件成功,但第二个就错误.此时ftpgetfile调用返回0,不知道该如何解决?