knkim
Hello~
I have a problem with SmartFTP Library sample source win32.
The sample alaways return error(= ftpErrorWrongReply) in ReadDirectory().
So I downloaded SmartFTP Client. The client run very well.
I don't know why error. help me..
Here is the sample source code and log data.
Thank you
===============================================
===============================================
[20050915 06:48:45] SmartFTP FTP Library v1.5.6.0
[20050915 06:48:45] Resolving host name "[fe80::20f:20ff:fe27:95ae%4]"
[20050915 06:48:45] Connecting to [fe80::20f:20ff:fe27:95ae%4] Port: 21
[20050915 06:48:45] Connected to [fe80::20f:20ff:fe27:95ae%4].
[20050915 06:48:45] 220 Gene6 FTP Server v3.6.0 (Build 23) ready...
[20050915 06:48:45] USER knkim
[20050915 06:48:45] 331 Password required for knkim.
[20050915 06:48:45] PASS test123
[20050915 06:48:45] 230 User knkim logged in.
[20050915 06:48:45] SYST
[20050915 06:48:45] 215 UNIX Type: L8
[20050915 06:48:45] FEAT
[20050915 06:48:45] 211-Extensions supported:
[20050915 06:48:45] AUTH TLS
[20050915 06:48:45] CCC
[20050915 06:48:45] CLNT
[20050915 06:48:45] CPSV
[20050915 06:48:45] EPRT
[20050915 06:48:45] EPSV
[20050915 06:48:45] MDTM
[20050915 06:48:45] MLST type*;size*;created;modify*;
[20050915 06:48:45] PASV
[20050915 06:48:45] PBSZ
[20050915 06:48:45] PROT
[20050915 06:48:45] REST STREAM
[20050915 06:48:45] SIZE
[20050915 06:48:45] SSCN
[20050915 06:48:45] TVFS
[20050915 06:48:45] UTF8
[20050915 06:48:45] XCRC "filename" SP EP
[20050915 06:48:45] XMD5 "filename" SP EP
[20050915 06:48:45] 211 End.
[20050915 06:48:45] Detected Server Software: Gene6 FTP Server 3.x
[20050915 06:48:45] OPTS UTF8 ON
[20050915 06:48:45] 501 Please CLNT first.
[20050915 06:48:45] PWD
[20050915 06:48:45] 257 "/" is current directory.
[20050915 06:48:45] CWD ./
[20050915 06:48:45] 250 CWD command successful. "/" is current directory.
[20050915 06:48:45] PWD
[20050915 06:48:45] 257 "/" is current directory.
[20050915 06:48:45] TYPE I
[20050915 06:48:45] 200 Type set to I.
[20050915 06:48:45] EPSV
[20050915 06:48:45] 501 Please try again later.
I have a problem with SmartFTP Library sample source win32.
The sample alaways return error(= ftpErrorWrongReply) in ReadDirectory().
So I downloaded SmartFTP Client. The client run very well.
I don't know why error. help me..
Here is the sample source code and log data.
Thank you
===============================================
sfFTPLib::IGlobalPtr pGlobal;
HRESULT hr = pGlobal.CreateInstance(__uuidof(sfFTPLib::Global));
if(SUCCEEDED(hr))
{
    // verify license key
    if(pGlobal->LoadLicenseKeyData(g_szLicenseKey) == VARIANT_TRUE)
        _tprintf(_T("License key verified.n"));
    else
        _tprintf(_T("Failed to verify license key.n"));
}
sfFTPLib::IFTPConnectionPtr ftp;
hr = ftp.CreateInstance(__uuidof(sfFTPLib::FTPConnectionMTA));
if(SUCCEEDED(hr))
{
    // AUTH TLS
    //ftp->Protocol = sfFTPLib::ftpProtocolSSLExplicit;
    ftp->Protocol = sfFTPLib::ftpProtocolNormal;
    ftp->Host = _T("[fe80::20f:20ff:fe27:95ae%4]");
    ftp->Port = 21;
    ftp->Username = _T("knkim");
    ftp->Password = _T("test123");
    ftp->Passive = VARIANT_TRUE;
    // No Proxy
    ftp->ProxyType = sfFTPLib::ftpProxyTypeNone;
    ftp->ProxyHost =_T("192.168.1.10");
    ftp->ProxyPort = 1080;
    ftp->ProxyAuthentication = VARIANT_TRUE;
    ftp->ProxyUsername = _T("user");
    ftp->ProxyPassword = _T("pass");
    // log everything 
    ftp->LogFile = _T("Win32Demo.log");
    // Connect
    sfFTPLib::enumError err = ftp->Connect();
    if(err == sfFTPLib::ftpErrorSuccess)
    {
        // change directory
        err = ftp->ChangeDirectory(_T("./"));
        if(err == sfFTPLib::ftpErrorSuccess)
        {
            printf("ChangeDirectory() OKn");
    	
            // read listing
            err = ftp->ReadDirectory();
            if(err == sfFTPLib::ftpErrorSuccess)
            {
                printf("ReadDirectory() OKn");
	sfFTPLib::IFTPDirectoryPtr pDirectory = ftp->Directory;
	if(pDirectory)
	{
                    int nCount = pDirectory->Count;
                    _tprintf(_T("Count = %dn"), nCount);  
                    // Enum
                    if(nCount > 0)
                    {
                        IEnumVARIANTPtr pEnum = pDirectory->_NewEnum;
                        VARIANT *pArrVariant = new VARIANT[nCount];
                        if(pArrVariant)
                        {
                            ULONG CeltFetched;
                            if(SUCCEEDED(pEnum->Next(nCount, pArrVariant, &CeltFetched)))
                            {
                                for(ULONG i=0; i<CeltFetched; i++)
                                {
                                    if(pArrVariant[i].vt == VT_DISPATCH)
                                    {
                                        //IDispatchPtr pDisp =;
                                        sfFTPLib::IFTPItemPtr pFTPItem = pArrVariant[i].pdispVal;
                                        if(pFTPItem)
                                        {
                                            _tprintf(_T("Type=0x%x; Name=%s; Size=%dn"), pFTPItem->Type, (LPCTSTR)pFTPItem->Name, pFTPItem->Size);
                                            if(pFTPItem->Type == sfFTPLib::ftpItemTypeLink)
                                            {
                                                _tprintf(_T("LinkPoint=%s"), (LPCTSTR)pFTPItem->LinkPoint);
                                            }
                                        }
                                    }
                                    ::VariantClear(&pArrVariant[i]);
                                }
                            }
                            delete [] pArrVariant;
                        }
                    }
                }
            }
            else
            {
                _tprintf(_T("ReadDirectory() failed. Error=%dn"), err);
                _tprintf(_T("LastReplyCode = %dn"), ftp->LastReplyCode);
                _tprintf(_T("LastReply = %sn"), (LPCTSTR)ftp->LastReply);
            }
        }
    }
    else
    {
        if(err == sfFTPLib::ftpErrorLicense)
            _tprintf(_T("Please acquire a license from https://www.smartftp.comn"));
        else
            _tprintf(_T("Connect() failed. Error=%dn"), err);
    }
}
else
{
    _tprintf(_T("Failed to create CFTPConnection instance.n"));
}
[20050915 06:48:45] SmartFTP FTP Library v1.5.6.0
[20050915 06:48:45] Resolving host name "[fe80::20f:20ff:fe27:95ae%4]"
[20050915 06:48:45] Connecting to [fe80::20f:20ff:fe27:95ae%4] Port: 21
[20050915 06:48:45] Connected to [fe80::20f:20ff:fe27:95ae%4].
[20050915 06:48:45] 220 Gene6 FTP Server v3.6.0 (Build 23) ready...
[20050915 06:48:45] USER knkim
[20050915 06:48:45] 331 Password required for knkim.
[20050915 06:48:45] PASS test123
[20050915 06:48:45] 230 User knkim logged in.
[20050915 06:48:45] SYST
[20050915 06:48:45] 215 UNIX Type: L8
[20050915 06:48:45] FEAT
[20050915 06:48:45] 211-Extensions supported:
[20050915 06:48:45] AUTH TLS
[20050915 06:48:45] CCC
[20050915 06:48:45] CLNT
[20050915 06:48:45] CPSV
[20050915 06:48:45] EPRT
[20050915 06:48:45] EPSV
[20050915 06:48:45] MDTM
[20050915 06:48:45] MLST type*;size*;created;modify*;
[20050915 06:48:45] PASV
[20050915 06:48:45] PBSZ
[20050915 06:48:45] PROT
[20050915 06:48:45] REST STREAM
[20050915 06:48:45] SIZE
[20050915 06:48:45] SSCN
[20050915 06:48:45] TVFS
[20050915 06:48:45] UTF8
[20050915 06:48:45] XCRC "filename" SP EP
[20050915 06:48:45] XMD5 "filename" SP EP
[20050915 06:48:45] 211 End.
[20050915 06:48:45] Detected Server Software: Gene6 FTP Server 3.x
[20050915 06:48:45] OPTS UTF8 ON
[20050915 06:48:45] 501 Please CLNT first.
[20050915 06:48:45] PWD
[20050915 06:48:45] 257 "/" is current directory.
[20050915 06:48:45] CWD ./
[20050915 06:48:45] 250 CWD command successful. "/" is current directory.
[20050915 06:48:45] PWD
[20050915 06:48:45] 257 "/" is current directory.
[20050915 06:48:45] TYPE I
[20050915 06:48:45] 200 Type set to I.
[20050915 06:48:45] EPSV
[20050915 06:48:45] 501 Please try again later.