Arduino TinyFTP
Loading...
Searching...
No Matches
FTPSession.h
1#pragma once
2
3#include "FTPBasicAPI.h"
4
5namespace tinyftp {
16template <class ClientType>
17class FTPSession : public FTPBasicAPI {
18 public:
19 FTPSession() { FTPLogger.writeLog(LOG_DEBUG, "FTPSession"); }
20
21 ~FTPSession() {
22 FTPLogger.writeLog(LOG_DEBUG, "~FTPSession");
23 end();
24 }
25
27 bool begin(IPAddress &address, int port, const char *username,
28 const char *password) {
29 return FTPBasicAPI::begin(&command_client, &data_client, address, port,
30 username, password);
31 }
32
34 void end() {
35 FTPLogger.writeLog(LOG_DEBUG, "FTPSession", "end");
36 command_client.stop();
37 data_client.stop();
38 is_open = false;
40 }
41
43 bool connected() { return is_open && command_client.connected(); }
44
45 operator bool() { return connected(); }
46
47 protected:
48 ClientType command_client;
49 ClientType data_client;
50};
51
52} // namespace tinyftp
FTPBasicAPI Implementation of Low Level FTP protocol. In order to simplify the logic we always use Pa...
Definition FTPBasicAPI.h:17
void resetTransfer()
Forgets the current transfer: e.g. when the connection was closed.
Definition FTPBasicAPI.h:347
FTPSession An FTPBasicAPI which owns its command and data connections.
Definition FTPSession.h:17
bool connected()
Returns true if logged in and the command connection is still alive.
Definition FTPSession.h:43
bool begin(IPAddress &address, int port, const char *username, const char *password)
Opens the command connection and logs in.
Definition FTPSession.h:27
void end()
Closes the command and data connections.
Definition FTPSession.h:34
FTP client and server functionality.
Definition FTPBasicAPI.h:7