FileZillaFTP Server Source Code Analysis: FileZilla is a free and open-source FTP tool. Including FileZilla Client and FileZilla Server. FileZilla Server only provides windows versions. to upload a local website webpage file to the website Server or download a webpage file from the Server, you only need the FileZilla Client Version. FileZilla FTP Server Source Code Analysis
FileZilla is an open-source FTP server written in C ++. By analyzing its source code, you can master the design of C ++ network programming and high-concurrency servers.
FileZilla is a project on the http://sourceforge.net, and the version we want to study is: FileZilla Server 0_9_18, in fact FileZilla also includes client software.
After downloading and installing, select "Install source" to install the source code.
After the installation is complete, you can directly open the FileZilla server. sln that comes with the project. This is the vs 2003.net project, which contains three projects,
FZS Interface: set and monitor the FTP server.
Service: This is part of the core FTP server.
GFtp: it cannot be opened. I don't know what it is for. Will foreigners be so careless? :)
Directly compiling is prone to errors. FileZilla depends on two third-party packages: zlib (compression algorithm package) and regexp (Regular Expression package)
First, get zlib, download and unlock, generate the directory zlib123, and open zlib123 \ projects \ visualc6 \ zlib. dsw with. net 2003
Open generate | Configuration Manager, set the active solution configuration to DLL Release, compile and generate the zlib project, and then generate zlib1.lib and zlib1.dll under Win32_DLL_Release.
Then, regexp uses a third-party boost package, which contains many common C ++ components.
After downloading and unzipping, in cmd,
Step 1: Compile bjm. This is the boost compiler.
Cd boost_000033_1 \ tools \ build \ jam_src
Build. bat
The bjam.exe file is generated in the current bin.ntx86directory.
Step 2: Compile boost
Cd boost_000033_1
Copy the just-generated bjam.exe file.
Set VC7_ROOT = "C: \ Program Files \ Microsoft Visual Studio. NET 2003 \ Vc7"
Bjam "-sTOOLS = vc7" install
This step takes a long time. At that time, we only used the regexp package in it. We should be able to compile only this package, but I did not study it carefully.
After compilation, the boost directory is generated under the root directory of the C drive. the. net project under this directory will be used.
In the. net project, add
Executable File: zlib123 \ projects \ visualc6 \ Win32_DLL_Release
Contains files: zlib123 directory and c: \ Boost \ include \ boost-1_33_1
Library File: zlib123 \ projects \ visualc6 \ Win32_DLL_Release and c: \ Boost \ lib
The FZS Interface project can be compiled successfully. After compilation, FileZilla Server Interface.exe is generated in the Debug directory.
When generating a Service project, you need to adjust the Project Settings:
Language settings: Open the project properties page and configure properties | General, select "use Unicode Character Set" as the character set, otherwise unicode must be used during compilation;
Link settings: Open the project properties page, configure properties | linker, and change zlib. lib to zlib1.lib (because zlib123 project generates zlib1.lib)
The following code is generated. When the Service project is generated, the "FileZilla Server FTP server" Service is automatically installed. You can also manually install the Service:
Cd FileZilla_Server \ Debug
"FileZilla server.exe" install auto
You can try this FTP Server and run FileZilla_Server \ interface \ Debug \ FileZilla Server Interface.exe. This is the configuration monitoring program of the FTP Server. add several users and set home dir, try again using the FTP client.