This class provides methods for manipulating the FTP protocol (described in RFC 959). More...
#include <Ftp.hpp>
Classes | |
class | DirectoryResponse |
Specialization of FTP response returning a directory. More... | |
class | ListingResponse |
Specialization of FTP response returning a filename lisiting. More... | |
class | Response |
This class wraps a FTP response, which is basically : More... | |
Public Types | |
enum | TransferMode { Binary, Ascii, Ebcdic } |
Enumeration of transfer modes. More... | |
Public Member Functions | |
~Ftp () | |
Destructor – close the connection with the server. | |
Response | Connect (const IPAddress &Server, unsigned short Port=21, float Timeout=0.f) |
Connect to the specified FTP server. | |
Response | Login () |
Log in using anonymous account. | |
Response | Login (const std::string &UserName, const std::string &Password) |
Log in using a username and a password. | |
Response | Disconnect () |
Close the connection with FTP server. | |
Response | KeepAlive () |
Send a null command just to prevent from being disconnected. | |
DirectoryResponse | GetWorkingDirectory () |
Get the current working directory. | |
ListingResponse | GetDirectoryListing (const std::string &Directory="") |
Get the contents of the given directory (subdirectories and files) | |
Response | ChangeDirectory (const std::string &Directory) |
Change the current working directory. | |
Response | ParentDirectory () |
Go to the parent directory of the current one. | |
Response | MakeDirectory (const std::string &Name) |
Create a new directory. | |
Response | DeleteDirectory (const std::string &Name) |
Remove an existing directory. | |
Response | RenameFile (const std::string &File, const std::string &NewName) |
Rename a file. | |
Response | DeleteFile (const std::string &Name) |
Remove an existing file. | |
Response | Download (const std::string &DistantFile, const std::string &DestPath, TransferMode Mode=Binary) |
Download a file from the server. | |
Response | Upload (const std::string &LocalFile, const std::string &DestPath, TransferMode Mode=Binary) |
Upload a file to the server. | |
Friends | |
class | DataChannel |
This class provides methods for manipulating the FTP protocol (described in RFC 959).
It provides easy access and transfers to remote directories and files on a FTP server
sf::Ftp::~Ftp | ( | ) |
Destructor – close the connection with the server.
Response sf::Ftp::ChangeDirectory | ( | const std::string & | Directory | ) |
Change the current working directory.
Directory | : New directory, relative to the current one |
Response sf::Ftp::Connect | ( | const IPAddress & | Server, |
unsigned short | Port = 21 , |
||
float | Timeout = 0.f |
||
) |
Connect to the specified FTP server.
Server | : FTP server to connect to |
Port | : Port used for connection (21 by default, standard FTP port) |
Timeout | : Maximum time to wait, in seconds (0 by default, means no timeout) |
Response sf::Ftp::DeleteDirectory | ( | const std::string & | Name | ) |
Remove an existing directory.
Name | : Name of the directory to remove |
Response sf::Ftp::DeleteFile | ( | const std::string & | Name | ) |
Remove an existing file.
Name | : File to remove |
Response sf::Ftp::Disconnect | ( | ) |
Close the connection with FTP server.
Response sf::Ftp::Download | ( | const std::string & | DistantFile, |
const std::string & | DestPath, | ||
TransferMode | Mode = Binary |
||
) |
Download a file from the server.
DistantFile | : Path of the distant file to download |
DestPath | : Where to put to file on the local computer |
Mode | : Transfer mode (binary by default) |
ListingResponse sf::Ftp::GetDirectoryListing | ( | const std::string & | Directory = "" | ) |
Get the contents of the given directory (subdirectories and files)
Directory | : Directory to list ("" by default, the current one) |
DirectoryResponse sf::Ftp::GetWorkingDirectory | ( | ) |
Get the current working directory.
Response sf::Ftp::KeepAlive | ( | ) |
Send a null command just to prevent from being disconnected.
Response sf::Ftp::Login | ( | ) |
Log in using anonymous account.
Response sf::Ftp::Login | ( | const std::string & | UserName, |
const std::string & | Password | ||
) |
Log in using a username and a password.
UserName | : User name |
Password | : Password |
Response sf::Ftp::MakeDirectory | ( | const std::string & | Name | ) |
Create a new directory.
Name | : Name of the directory to create |
Response sf::Ftp::ParentDirectory | ( | ) |
Go to the parent directory of the current one.
Response sf::Ftp::RenameFile | ( | const std::string & | File, |
const std::string & | NewName | ||
) |
Rename a file.
File | : File to rename |
NewName | : New name |
Response sf::Ftp::Upload | ( | const std::string & | LocalFile, |
const std::string & | DestPath, | ||
TransferMode | Mode = Binary |
||
) |
Upload a file to the server.
LocalFile | : Path of the local file to upload |
DestPath | : Where to put to file on the server |
Mode | : Transfer mode (binary by default) |