BOOL bRet = FtpCommand(hConnection, // WinInet Connection handle
                           FALSE,        // 为什么为TRUE时,返回值为FALSE?
                           FTP_TRANSFER_TYPE_BINARY, // I'm receiving ASCII
                           _T("REST 100"),      // This is the FTP command I am passing
                           1,           // No context needed
                           &hResponse); // The handle to read the response 如何得到服务器的返回码?

解决方案 »

  1.   

    推荐你用SOCKET向服务器发送命令,然后接受返回信息
      

  2.   

    发送FTP命令到服务器,FTP服务器会返回相关信息。查看FTP协议命令,用socket直接收发
      

  3.   

    phFtpCommand
    [out] Pointer to an HINTERNET handle that will be created if a valid data socket is opened. The fExpectResponse parameter must be set to TRUE for phFtpCommand to be filled.
      

  4.   

    function FtpCommandDirList(hFtpSession: HINTERNET): String;
    var
      data_handle: HINTERNET;
      bytes_read: DWORD;
      text_buffer: PChar;
      buffer_size: DWORD;
    begin
      result := '';
      data_handle := NIL;
      if not FtpCommand(m_hFtpSession,true,FTP_TRANSFER_TYPE_ASCII,
        PChar('NLST'),0,@data_handle) then
      begin
        SetErrorCode(GetLastError());
        Application.MessageBox(PChar(SysErrorMessage(GetLastError())),'');
        exit;
      end;
      // Read the data.
      buffer_size := 1000;    // Arbitrary value.
      GetMem(text_buffer,buffer_size);
      bytes_read := 1;
      while bytes_read > 0 do
      begin
        InternetReadFile(data_handle,text_buffer,buffer_size, bytes_read);
        result := result + System.Copy(text_buffer,0,bytes_read);
      end;
      InternetCloseHandle(data_handle);
      FreeMem(text_buffer,buffer_size);
    end;
      

  5.   

    to:zfive5(醉马不肖 之 [孤舟蓑笠翁, 独钓寒江雪]) 
    BOOL bRet = FtpCommand(hConnection, // WinInet Connection handle
                               FALSE,        // 为什么为TRUE时,返回值为FALSE?
                               FTP_TRANSFER_TYPE_BINARY, // I'm receiving ASCII
                               _T("REST 100"),      // This is the FTP command I am passing
                               1,           // No context needed
                               &hResponse); // The handle to read the response 
    为什么为TRUE时,返回值为FALSE?