用INDY9开发FTP客户端_01
-- INDY9的安装
Roger Yang
最近写了一个支持多线程、断点续传和下载限速功能的FTP客户端
开发工具使用BCB6+SP4和INDY 9.0.17。INDY9是一套很不错的控件组,大大简化了开发网络应用程序的难度。而且它是开源的。BCB6自带的INDY版本比较旧,所以去INDY的官方网站http://www.indyproject.org/下载最新版本进行更新。官方网站上最新提供的下载版本是9.0.18,但感觉里面文件不全,几个安装需要的批处理文件都没有。所以我还是使用9.0.17。
INDY9的安装比较麻烦,下面是INDY官方网站上提供的一个安装方法。
· Close the Borland C++ Builder IDE if it is open.
· Remove all Indy files including dclindy*.bpl, dclindy.*, dclindy*.bpl, indy*.lib, id*.pas, id*.hpp, id*.obj, and id*.dcu. Take care that you only remove the old Indy files and not something else. Be sure that you also remove any indy*.bpl from your Windows/System32 directory.
· Remove all old Indy Help files, indy.*, from the Help subdirectory and replace them with the new ones.
· Place the new version of Indy in a directory of your choice. When unzipping, please keep the /source directory for the archive intact because that is used by some build batch files.
· In the source directory, there are several batch files. Run the appropriate one for your version of Borland C++ Builder:
· FULLC4.BAT - Borland C++ Builder 4
· FULLC5.BAT - Borland C++ Builder 5
· FULLC6.BAT - Borland C++ Builder 6
· These batch files create subdirectories in the main Indy directory folder. They are (C4 for C++Builder 4, C5 for C+Builder 5, and C6 for C++Builder 6). These directories contain:
· The Indy .DCU files
· The Indy .HPP files
· The Indy .LIB file
· The Indy .OBJ files
· The Indy Design-Time .BPL
· Open the Borland C++ Builder IDE.
· In your C++Builder IDE, add the Indy design-time package with Component|Install Package...|Add... Go to the subdirectory where the Indy .DCU's and Design-Time .BPL was placed by the batch file. Add the Design-Time .BPL that is listed. It usually is named dclIndy followed by the Borland C++ Builder version and an 0.
· Add the path where the .DCU's are located to your environment. Do this with Tools|Environment Options...|Library...|Library Path...
· Add the path where the .HPP's are located to your project. Do this with Project|Options|Directories|Conditionals|Include path. Check the box Default and click OK to save this setting.
这个方法要手工删除INDY的旧文件,很容易出错,试过两次都有些问题。
我使用的是下面这个方法,操作起来相对简单,而且仔细点是不会出错的。
(1)移除 BCB6 中原本的 Indy
(1.1)放入原本安装 BCB6 的光碟片,选择“C++ Builder 6”
(1.2)在 Borland C++ Builder 6 Enterprise Edition - Installation
Wizard 中,按“Next”
(1.3)在“Program Maintenance”Dialog 中,选择“Modify”然后按
“Next”
(1.4)在“Custom Setup”Dialog 中,点选“Program Files/Indy”节点,
并选择“Do not Install”然后按“Next”
(1.5)剩下的步骤都按“Next”就可以将 BCB6 中原本的 Indy 给移除了
(2)安装新版本的 Indy (9.0.1X)
(2.1)新版的 Indy (9.0.1X) 可在此下载
http://www.indyproject.org/download/Indy9.html
(2.2)将下载的档案 IndyWin32_9_00_1X_Src.zip 解压缩至目录 C:/Indy
(解压缩后会多一个子目录 C:/Indy/Source)
(2.3)执行档案 C:/Indy/Source/Fullc6.bat (Command line)
(2.4)执行完成以后,会多一个子目录 C:/Indy/C6
(3)在 BCB6 中设定新版本的 Indy (9.0.11)
(3.1)开启 C++ Builder 6.0 (在开启的过程中会出现连结不到 Indy Lib 的
提示 Dialog,选择 Yes 跳过)
(3.2)在 BCB6 中选择“Tools/Environment Options”
(3.3)在“Environment Options”Dialog 中,选择“Library”Tab
(3.4)在“Library Path”栏位中加入字串“;C:/Indy/C6”,然后按“OK”
Button
(3.5)在 BCB6 中选择“Project/Options”
(3.6)在“Project Options”Dialog 中,选择“Packages”Tab
(3.7)按“Add”Button,并将档案指向 C:/Indy/C6/dclIndy60.bpl
(3.在“Project Options”Dialog 中,选择“Directories /
Conditionals”Tab
(3.9)在“Include Path”及“Library Path”两个栏位的最前面,分别加入
字串“C:/Indy/C6;”
(3.10)在“Project Options”Dialog 中,将左下角的“Default”打勾,然
后按“OK”Button
(3.11)把 BCB6 关闭,然后重新开启,如果不会出现(3.1)中的 Dialog 的
话,就代表已经设定成功