Qore Programming Language Reference Manual  1.2.0
QC_FtpClient.dox.h
1 
3 namespace Qore {
5 
9  int code;
11  string msg;
12 };
13 }
14 
16 namespace Qore {
18 
98 class FtpClient {
99 
100 public:
102 
112 
113 public:
115 
125 
126 public:
128 
145 nothing connect();
146 
147 public:
149 
155 
156 public:
158 
170  constructor(string url);
171 
172 public:
174 
176  copy();
177 
178 public:
180 
193 nothing cwd(string path);
194 
195 public:
197 
212 nothing del(string remote_path);
213 
214 public:
216 
225 
226 public:
228 
236 nothing disconnect();
237 
238 public:
240 
264 nothing get(string remote_path, *string local_path);
265 
266 public:
268 
288 nothing get(string remote_path, Qore::OutputStream os);
289 
290 public:
292 
312 binary getAsBinary(string remote_path);
313 
314 public:
316 
336 string getAsString(string remote_path);
337 
338 public:
340 
356 hash<auto> getControlPeerInfo(bool host_lookup = True);
357 
358 public:
360 
376 hash<auto> getControlSocketInfo(bool host_lookup = True);
377 
378 public:
380 
396 hash<auto> getDataPeerInfo(bool host_lookup = True);
397 
398 public:
400 
416 hash<auto> getDataSocketInfo(bool host_lookup = True);
417 
418 public:
420 
427 *string getHostName();
428 
429 public:
431 
441 string getMode();
442 
443 public:
445 
458 
459 public:
461 
468 *string getPassword();
469 
470 public:
472 
479 int getPort();
480 
481 public:
483 
495 
496 public:
498 
510 
511 public:
513 
521 
522 public:
524 
531 string getURL();
532 
533 public:
535 
557 
558 public:
560 
567 *string getUserName();
568 
569 public:
571 
583 
584 public:
586 
596 bool isSecure();
597 
598 public:
600 
617 *string list();
618 
619 public:
621 
640 *string list(string path);
641 
642 public:
644 
659 nothing mkdir(string remote_path);
660 
661 public:
663 
680 *string nlst();
681 
682 public:
684 
703 *string nlst(string path);
704 
705 public:
707 
730 nothing put(string local_path, *string remote_path);
731 
732 public:
734 
754 nothing put(Qore::InputStream is, string remote_path);
755 
756 public:
758 
774 nothing putData(string data, string remote_path);
775 
776 public:
778 
794 nothing putData(binary data, string remote_path);
795 
796 public:
798 
813 string pwd();
814 
815 public:
817 
833 nothing rename(string from, string to);
834 
835 public:
837 
852 nothing rmdir(string remote_path);
853 
854 public:
856 
865 hash<FtpResponseInfo> sendControlMessage(string cmd, string arg);
866 
867 public:
869 
875 
876 public:
878 
893 nothing setControlEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
894 
895 public:
897 
903 
904 public:
906 
921 nothing setDataEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
922 
923 public:
925 
930 nothing setEventQueue();
931 
932 public:
934 
949 nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
950 
951 public:
953 
960 nothing setHostName(string host);
961 
962 public:
964 
971 nothing setInsecure();
972 
973 public:
975 
983 nothing setInsecureData();
984 
985 public:
987 
992 nothing setModeAuto();
993 
994 public:
996 
1001 nothing setModeEPSV();
1002 
1003 public:
1005 
1010 nothing setModePASV();
1011 
1012 public:
1014 
1019 nothing setModePORT();
1020 
1021 public:
1023 
1034 nothing setNetworkFamily(int family);
1035 
1036 public:
1038 
1045 nothing setPassword(string pass);
1046 
1047 public:
1049 
1058 nothing setPort(int port);
1059 
1060 public:
1062 
1071 nothing setSecure(bool secure = True);
1072 
1073 public:
1075 
1079  setTimeout(timeout timeout_ms);
1080 
1081 public:
1083 
1095 nothing setURL(string url);
1096 
1097 public:
1099 
1106 nothing setUserName(string user);
1107 
1108 public:
1110 
1142 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1143 
1144 public:
1146 
1158 };
1159 }
The FtpClient class allows Qore code to communicate with FTP servers with the FTP and FTPS protocols.
Definition: QC_FtpClient.dox.h:98
setTimeout(timeout timeout_ms)
sets the socket I/O timeout value in milliseconds
nothing setSecure(bool secure=True)
Make an FTPS connection to the server on the next connect if the argument is True.
nothing setEventQueue()
Clears any Queue object that may be set on the FtpClient object so that I/O events are no longer capt...
nothing setUserName(string user)
Sets the user name to use for the next connection.
clearStats()
Clears performance statistics.
nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive FtpClient and Socket events on both the data and control connections.
nothing setModePASV()
Sets the object to only try to make data connections using PASV (RFC-959 passive) mode.
nothing setNetworkFamily(int family)
Sets the network address family to use for new connections; use this method to restrict connections t...
*string list()
Returns a list of files from the FTP server in the server's long format in the current working direct...
int getNetworkFamily()
Returns the network address family to use for new connections.
nothing get(string remote_path, *string local_path)
Gets a file from the FTP server and stores it on the local filesystem; if any errors occur,...
bool isDataSecure()
Returns True if the data connections are secure TLS/SSL connections, False if not.
nothing putData(binary data, string remote_path)
Transfers binary data to the FTP server and saves it as a file on the remote machine; if any errors o...
hash< FtpResponseInfo > sendControlMessage(string cmd, string arg)
Sends a message on the control connection with a reply on the control connection only.
string getURL()
Retrieves the current connection URL string for this object.
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
constructor(string url)
Creates an FtpClient object and initializes it with a URL.
*string getSSLCipherVersion()
Returns the version of the cipher for an encrypted connection or NOTHING if an encrypted connection i...
hash< auto > getDataPeerInfo(bool host_lookup=True)
Returns information about the remote data socket as a hash.
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms=1s)
Sets a Queue object to receive socket warnings.
*string getUserName()
Returns the current username value or NOTHING if none is set.
string pwd()
Returns the server-side current working directory.
nothing setURL(string url)
Sets the connection and login parameters based on the URL passed as an argument.
copy()
Throws an exception to prevent copying of objects this class.
nothing setDataEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive FtpClient and Socket events on the data connection.
nothing setDataEventQueue()
Clears any Queue object that may be set on the FtpClient object so that I/O events are no longer capt...
binary getAsBinary(string remote_path)
Gets a file from the FTP server and returns it as a binary.
nothing setInsecureData()
Make a non-encrypted data connection to the server on the next connect even if the control connection...
*string nlst(string path)
Returns a list of file names from the FTP server for the given path or NOTHING if the path cannot be ...
int getPort()
Retrieves the current connection port value for this object.
nothing disconnect()
Disconnects from an FTP server.
*string verifyPeerCertificate()
Returns a string code giving the result of verifying the remote certificate or NOTHING if an encrypte...
nothing put(string local_path, *string remote_path)
Transfers a local file to the FTP server; if any errors occur, an exception is thrown.
hash getUsageInfo()
Returns performance statistics for the socket.
nothing mkdir(string remote_path)
Creates a directory on the FTP server; if any errors occur, an exception is thrown.
string getAsString(string remote_path)
Gets a file from the FTP server and returns it as a string.
nothing setControlEventQueue()
Clears any Queue object that may be set on the FtpClient object so that I/O events are no longer capt...
hash< auto > getDataSocketInfo(bool host_lookup=True)
Returns information about the local data socket as a hash.
nothing get(string remote_path, Qore::OutputStream os)
Gets a file from the FTP server and writes it to an OutputStream; if any errors occur,...
nothing setModeEPSV()
Sets the object to only try to make data connections using EPSV (RFC-2428 extended passive) mode.
*string nlst()
Returns a list of file names from the FTP server in the current working directory or NOTHING if the p...
hash< auto > getControlSocketInfo(bool host_lookup=True)
Returns information about the local control socket as a hash.
nothing del(string remote_path)
Deletes a file from the FTP server; if any errors occur, an exception is thrown.
nothing setPort(int port)
Sets the control port value to use for the next connection (the FTP protocol default is 21)
destructor()
Disconnects any remote connection and destroys the object.
hash< auto > getControlPeerInfo(bool host_lookup=True)
Returns information about the remote end of the control socket as a hash.
nothing setHostName(string host)
Sets the hostname or address to use to connect to for the next connection.
string getMode()
returns a string for the connection mode: "port", "pasv", "epsv", or "auto" if not connected and auto...
nothing rmdir(string remote_path)
Removes a directory on the remote FTP server; if any errors occur, an exception is thrown.
nothing put(Qore::InputStream is, string remote_path)
Transfers the content of an InputStream to the FTP server; if any errors occur, an exception is throw...
int getTimeout()
returns the socket I/O timeout value as an integer in milliseconds
nothing rename(string from, string to)
Renames/moves a file or directory; if any errors occur, an exception is thrown.
nothing setModeAuto()
Sets the object to automatically try to negotiate the data connections in EPSV, PASV,...
bool isSecure()
Returns True if the control connection is a secure TLS/SSL connection, False if not.
*string list(string path)
Returns a list of files from the FTP server in the server's long format for the given path or NOTHING...
*string getSSLCipherName()
Returns the name of the cipher for an encrypted connection or NOTHING if an encrypted connection is n...
*string getPassword()
Returns the current password value or NOTHING if none is set.
nothing setInsecure()
Make a non-encrypted connection to the server on the next connect.
nothing setControlEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive FtpClient and Socket events on the control connection.
nothing setModePORT()
Sets the object to only try to make data connections using PORT mode.
nothing putData(string data, string remote_path)
Transfers string data to the FTP server and saves it as a file on the remote machine; if any errors o...
nothing connect()
Connects to the FTP server and attempts a login; if any errors occur, an exception is thrown.
*string getHostName()
Returns the current hostname value or NOTHING if none is set.
nothing cwd(string path)
Changes the current working directory on the server.
nothing setPassword(string pass)
Sets the password to use for the next connection.
constructor()
Creates an empty FtpClient object.
This class defines an abstract interface for input streams.
Definition: QC_InputStream.dox.h:19
This class defines an abstract interface for output streams.
Definition: QC_OutputStream.dox.h:18
Queue objects provide a blocking, thread-safe message-passing object to Qore programs
Definition: QC_Queue.dox.h:22
const True
logical True
Definition: qc_qore.dox.h:98
hash< auto > hash(object obj)
Returns a hash of an object's members.
binary binary()
Always returns an empty binary object (of zero length)
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
A hash describing a free-form FTP control response.
Definition: QC_FtpClient.dox.h:7
string msg
The response message string.
Definition: QC_FtpClient.dox.h:11
int code
The integer response code.
Definition: QC_FtpClient.dox.h:9