1 \section{\class{wxFTP
}}\label{wxftp
}
3 \wxheading{Derived from
}
5 \helpref{wxProtocol
}{wxprotocol
}
7 \wxheading{Include files
}
13 \helpref{wxSocketBase
}{wxsocketbase
}
15 % ----------------------------------------------------------------------------
17 % ----------------------------------------------------------------------------
19 \latexignore{\rtfignore{\membersection{Members
}}}
21 \membersection{wxFTP::SendCommand
}
23 \func{bool
}{SendCommand
}{\param{const wxString\&
}{ command
},
\param{char
}{ret
}}
25 Send the specified
\it{command
} to the FTP server.
\it{ret
} specifies
28 \wxheading{Return value
}
30 TRUE, if the command has been sent successfully, else FALSE.
32 % ----------------------------------------------------------------------------
34 \membersection{wxFTP::GetLastResult
}
36 \func{const wxString\&
}{GetLastResult
}{\void}
38 Returns the last command result.
40 % ----------------------------------------------------------------------------
42 \membersection{wxFTP::ChDir
}
44 \func{bool
}{ChDir
}{\param{const wxString\&
}{ dir
}}
46 Change the current FTP working directory.
47 Returns TRUE if successful.
49 \membersection{wxFTP::MkDir
}
51 \func{bool
}{MkDir
}{\param{const wxString\&
}{ dir
}}
53 Create the specified directory in the current FTP working directory.
54 Returns TRUE if successful.
56 \membersection{wxFTP::RmDir
}
58 \func{bool
}{RmDir
}{\param{const wxString\&
}{ dir
}}
60 Remove the specified directory from the current FTP working directory.
61 Returns TRUE if successful.
63 \membersection{wxFTP::Pwd
}
65 \func{wxString
}{Pwd
}{\void}
67 Returns the current FTP working directory.
69 % ----------------------------------------------------------------------------
71 \membersection{wxFTP::Rename
}
73 \func{bool
}{Rename
}{\param{const wxString\&
}{ src
},
\param{const wxString\&
}{ dst
}}
75 Rename the specified
\it{src
} element to
\it{dst
}. Returns TRUE if successful.
77 % ----------------------------------------------------------------------------
79 \membersection{wxFTP::RmFile
}
81 \func{bool
}{RmFile
}{\param{const wxString\&
}{ path
}}
83 Delete the file specified by
\it{path
}. Returns TRUE if successful.
85 % ----------------------------------------------------------------------------
87 \membersection{wxFTP::SetUser
}
88 \func{void
}{SetUser
}{\param{const wxString\&
}{ user
}}
90 Sets the user name to be sent to the FTP server to be allowed to log in.
92 \wxheading{Default value
}
94 The default value of the user name is "anonymous".
98 This parameter can be included in a URL if you want to use the URL manager.
99 For example, you can use: "ftp://a_user:a_password@a.host:service/a_directory/a_file"
100 to specify a user and a password.
102 \membersection{wxFTP::SetPassword
}
103 \func{void
}{SetPassword
}{\param{const wxString\&
}{ passwd
}}
105 Sets the password to be sent to the FTP server to be allowed to log in.
107 \wxheading{Default value
}
109 The default value of the user name is your email address. For example, it could
110 be "username@userhost.domain". This password is built by getting the current
111 user name and the host name of the local machine from the system.
115 This parameter can be included in a URL if you want to use the URL manager.
116 For example, you can use: "ftp://a_user:a_password@a.host:service/a_directory/a_
118 to specify a user and a password.
120 % ----------------------------------------------------------------------------
121 \membersection{wxFTP::GetList
}
122 \func{wxList *
}{GetList
}{\param{const wxString\&
}{ wildcard
}}
124 The GetList function is quite low-level. It returns the list of the files in
125 the current directory. The list can be filtered using the
\it{wildcard
} string.
126 If
\it{wildcard
} is a NULL string, it will return all files in directory.
128 The form of the list can change from one peer system to another. For example,
129 for a UNIX peer system, it will look like this:
131 -r--r--r--
1 guilhem lavaux
12738 Jan
16 20:
17 cmndata.cpp
132 -r--r--r--
1 guilhem lavaux
10866 Jan
24 16:
41 config.cpp
133 -rw-rw-rw-
1 guilhem lavaux
29967 Dec
21 19:
17 cwlex_yy.c
134 -rw-rw-rw-
1 guilhem lavaux
14342 Jan
22 19:
51 cwy_tab.c
135 -r--r--r--
1 guilhem lavaux
13890 Jan
29 19:
18 date.cpp
136 -r--r--r--
1 guilhem lavaux
3989 Feb
8 19:
18 datstrm.cpp
139 But on Windows system, it will look like this:
141 winamp~
1 exe
520196 02-
25-
1999 19:
28 winamp204.exe
142 1 file(s)
520 196 bytes
145 The list is a string list and one node corresponds to a line sent by the peer.
147 % ----------------------------------------------------------------------------
149 \membersection{wxFTP::GetOutputStream
}
151 \func{wxOutputStream *
}{GetOutputStream
}{\param{const wxString\&
}{ file
}}
153 Initializes an output stream to the specified
\it{file
}. The returned
154 stream has all but the seek functionality of wxStreams. When the user finishes
155 writing data, he has to delete the stream to close it.
157 \wxheading{Return value
}
159 An initialized write-only stream.
163 \helpref{wxOutputStream
}{wxoutputstream
}
165 % ----------------------------------------------------------------------------
167 \membersection{wxFTP::GetInputStream
}\label{wxftpgetinput
}
169 \func{wxInputStream *
}{GetInputStream
}{\param{const wxString\&
}{ path
}}
171 Creates a new input stream on the the specified path. You can use all but seek
172 functionnality of wxStream. Seek isn't available on all stream. For example,
173 http or ftp streams doesn't deal with it. Other functions like Tell
174 aren't available for the moment for this sort of stream.
175 You will be notified when the EOF is reached by an error.
177 \wxheading{Return value
}
179 Returns NULL if an error occured (it could be a network failure or the fact
180 that the file doesn't exist).
182 Returns the initialized stream. You will have to delete it yourself once you
183 don't use it anymore. The destructor close the DATA stream connection but
184 will leave the COMMAND stream connection opened. It means that you still
185 can send new commands without reconnecting.
187 \wxheading{Example of a standalone connection (without wxURL)
}
191 wxInputStream *in
\_stream;
194 ftp.Connect("a.host.domain");
195 ftp.ChDir("a
\_directory");
196 in
\_stream = ftp.GetInputStream("a
\_file\_to\_get");
198 data = new char
[in
\_stream->StreamSize()
];
200 in
\_stream->Read(data, in
\_stream->StreamSize());
201 if (in
\_stream->LastError() != wxStream
\_NOERROR)
{
205 delete in
\_stream; /* Close the DATA connection */
207 ftp.Close(); /* Close the COMMAND connection */
212 \helpref{wxInputStream
}{wxinputstream
}