🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #6

Re: FTP file download for Indy 9

#6
From: Bob Gonder
Date: Thu, 17 Jul 2008 19:01
45 lines
2107 bytes
ANTHONY WEST wrote:

>I am using Borland builder 4 standard. I have downloaded
>Indy 9 source code that I am attempting to figure out how to use,
>    if(URLDownloadToFile(0,updateLink.c_str(), fileName.c_str(),0,0))

That isn't an Indy function. It is a Win32 API function.
Microsoft also supports FTP with FtpGetFile() (no interaction)
or use the FtpOpenFile() and InternetReadFile() to report progress.
There is a fairly decent overview of the MS FTP here:
http://msdn.microsoft.com/en-us/library/aa384180(VS.85).aspx

InternetOpen()
InternetConnect() <-username and password here
FtpGetFile()
InternetCloseHandle()


if( NULL != (hInternetSession = InternetOpen(
			__argv[0],
			INTERNET_OPEN_TYPE_PRECONFIG,
			NULL, NULL, 0)) )
{
	hFTPSession = InternetConnect(
			hInternetSession,
			FtpServerURL,// ftp.MySite.com
			INTERNET_INVALID_PORT_NUMBER,
			Name,
			Password,
			INTERNET_SERVICE_FTP,
			0, (DWORD)0);
	if( NULL != hFTPSession )
	{
		bResult = FtpGetFile(
			hFTPSession,
			FromFilename,ToFilename,
		        FALSE,
		       	FILE_ATTRIBUTE_NORMAL,
			FTP_TRANSFER_TYPE_BINARY,
			0/*context*/);

		InternetCloseHandle( hFTPSession );
	};
	InternetCloseHandle( hInternetSession );
};
Technical Details
Message-ID: <4j3v745gekhkrf5skft0spuun1s7uo0hn1@4ax.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <487ef727$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,46736b455fe961ab
X-Google-Attributes: gid11508e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <none@nowhere.invalid>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: FTP file download for Indy 9
Date: Thu, 17 Jul 2008 12:01:47 -0700
Message-ID: <4j3v745gekhkrf5skft0spuun1s7uo0hn1@4ax.com>
References: <487ef727$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.147.31
X-Trace: newsgroups.borland.com 1216321305 67.77.147.31 (17 Jul 2008 12:01:45 -0700)
Lines: 47
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail