FTP: File Transfer Protocol

https://en.m.wikipedia.org/wiki/File_Transfer_Protocol

Server API

typedef FtpServer FTPServer

class FtpServer : public TcpServer
#include <FtpServer.h>

Public Functions

FtpServer()
void addUser(const String &login, const String &pass)
bool checkUser(const String &login, const String &pass)
virtual bool listen(int port, bool useSsl = false)
void setKeepAlive(uint16_t seconds)
void shutdown()
const Vector<TcpConnection *> &getConnections() const
virtual bool connect(const String &server, int port, bool useSsl = false)
virtual bool connect(IpAddress addr, uint16_t port, bool useSsl = false)
virtual void close()
int writeString(const char *data, uint8_t apiflags = TCP_WRITE_FLAG_COPY)
int writeString(const String &data, uint8_t apiflags = TCP_WRITE_FLAG_COPY)
virtual int write(const char *data, int len, uint8_t apiflags = TCP_WRITE_FLAG_COPY)

Base write operation.

Parameters
  • data:
  • len:
  • apiflags: TCP_WRITE_FLAG_COPY, TCP_WRITE_FLAG_MORE
Return Value
  • int: -1 on error

int write(IDataSourceStream *stream)
uint16_t getAvailableWriteSize()
void flush()
void setTimeOut(uint16_t waitTimeOut)
IpAddress getRemoteIp() const
uint16_t getRemotePort() const
void setDestroyedDelegate(TcpConnectionDestroyedDelegate destroyedDelegate)

Sets a callback to be called when the object instance is destroyed.

Parameters
  • destroyedDelegate:

void setSslInitHandler(Ssl::Session::InitDelegate handler)

Set the SSL session initialisation callback.

Parameters
  • handler:

bool setSslConnection(Ssl::Connection *connection)
Ssl::Session *getSsl()

Get a pointer to the current SSL session object.

Note that this is typically used so we can query properties of an established session. If you need to change session parameters this must be done via setSslInitHandler.

Public Members

uint16_t activeClients = 0