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 如何得到服务器的返回码?
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 如何得到服务器的返回码?
[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.
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;
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?