Click here to Skip to main content
14,696,499 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i have written the code below to download files from the FTP Server.

DWORD FTPImport::ImportAllFiles ( const CString& csSource_i, CString& csDestination_o )
    {
        HINTERNET hInternet;
        HINTERNET hConnect;

        try
        {
            // Open the FTP connection
            hInternet = InternetOpen( NULL, PRE_CONFIG_INTERNET_ACCESS, NULL, INTERNET_INVALID_PORT_NUMBER, 0 );
            if ( NULL == hInternet )
            {
                return;
            }

            // Connect to the specific FTP server.
            hConnect = InternetConnect( hInternet, m_csServerName, INTERNET_INVALID_PORT_NUMBER, m_csUserName,
                                        m_csPassword, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0 );
            if( NULL == hConnect )
            {
                DWORD dwError = GetLastError();
                // Translate ErrorCode to String.
                return;
            }



But the internet connection API always fails with error code 12007.
the server name i send is correct, so is the password and username.

Please please please do help..
i know this is a silly problem :(
Posted
Comments
Herman<T>.Instance 31-Jan-12 4:35am
   
ERROR_WINHTTP_NAME_NOT_RESOLVED
12007
The server name cannot be resolved.

see: here

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900