///////////////////////////////////////////////////////
| 228 | |
| 229 | //////////////////////////////////////////////////////////// |
| 230 | Ftp::ListingResponse Ftp::getDirectoryListing(const std::string& directory) |
| 231 | { |
| 232 | // Open a data channel on default port (20) using ASCII transfer mode |
| 233 | std::ostringstream directoryData; |
| 234 | DataChannel data(*this); |
| 235 | Response response = data.open(TransferMode::Ascii); |
| 236 | if (response.isOk()) |
| 237 | { |
| 238 | // Tell the server to send us the listing |
| 239 | response = sendCommand("NLST", directory); |
| 240 | if (response.isOk()) |
| 241 | { |
| 242 | // Receive the listing |
| 243 | data.receive(directoryData); |
| 244 | |
| 245 | // Get the response from the server |
| 246 | response = getResponse(); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | return {response, directoryData.str()}; |
| 251 | } |
| 252 | |
| 253 | |
| 254 | //////////////////////////////////////////////////////////// |