Added new classes to develop the FTP server
This commit is contained in:
parent
1317644b3d
commit
a01a151943
1
src/software_test/tcpServer_test/FTPClient.cpp
Normal file
1
src/software_test/tcpServer_test/FTPClient.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "FTPClient.h"
|
13
src/software_test/tcpServer_test/FTPClient.h
Normal file
13
src/software_test/tcpServer_test/FTPClient.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef FTPCLIENT_H
|
||||||
|
#define FTPCLIENT_H
|
||||||
|
|
||||||
|
#include "TCPClient.h"
|
||||||
|
|
||||||
|
class FTPClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //FTPCLIENT_H
|
32
src/software_test/tcpServer_test/FTPServer.h
Normal file
32
src/software_test/tcpServer_test/FTPServer.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef FTPSERVER_H
|
||||||
|
#define FTPSERVER_H
|
||||||
|
|
||||||
|
#include "TCPServer.h"
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class FTPServer : public TCPServer<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FTPServer(unsigned int port = 22, const char login = "", const char password = "", uint8_t maxClient = MAX_CLIENT, uint16_t clientCommandDataBufferSize = 255) : TCPServer<T>(port, maxClient, clientCommandDataBufferSize), _login(NULL), _password(NULL)
|
||||||
|
{
|
||||||
|
_login = (char *)malloc((sizeof(char) * strlen(login)) + 1);
|
||||||
|
if(_login != NULL)
|
||||||
|
strcpy(_login, login);
|
||||||
|
|
||||||
|
_password = (char *)malloc((sizeof(char) * strlen(password)) + 1);
|
||||||
|
if(_password != NULL)
|
||||||
|
strcpy(_password, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~FTPServer()
|
||||||
|
{
|
||||||
|
free(_login);free(_password);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
char *_login;
|
||||||
|
char *_password;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //FTPSERVER_H
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "WEBServer.h"
|
#include "WEBServer.h"
|
||||||
#include "TCPClient.h"
|
#include "TCPClient.h"
|
||||||
#include "Dictionary.h"
|
|
||||||
|
|
||||||
class WEBClient : public TCPClient
|
class WEBClient : public TCPClient
|
||||||
{
|
{
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
#include "TCPServer.h"
|
#include "TCPServer.h"
|
||||||
#include "WEBServer.h"
|
#include "WEBServer.h"
|
||||||
#include "WEBClient.h"
|
#include "WEBClient.h"
|
||||||
|
#include "FTPServer.h"
|
||||||
|
#include "FTPClient.h"
|
||||||
|
|
||||||
uint32_t lastFreeMem(0);
|
uint32_t lastFreeMem(0);
|
||||||
uint16_t lastClientCount(0);
|
uint16_t lastClientCount(0);
|
||||||
|
|
||||||
TCPServer<TCPClient> server(80, MAX_CLIENT, 5);
|
//TCPServer<TCPClient> server(80, MAX_CLIENT, 5);
|
||||||
WEBServer<WEBClient> webServer(8080);
|
//WEBServer<WEBClient> webServer(8080);
|
||||||
|
|
||||||
WiFiEventHandler gotIpEventHandler, disconnectedEventHandler;
|
WiFiEventHandler gotIpEventHandler, disconnectedEventHandler;
|
||||||
|
|
||||||
@ -39,17 +41,17 @@ void debugInfo()
|
|||||||
Serial.print("Heap Frag : ");Serial.println(frag);
|
Serial.print("Heap Frag : ");Serial.println(frag);
|
||||||
lastFreeMem = freeMem;
|
lastFreeMem = freeMem;
|
||||||
}
|
}
|
||||||
if(lastClientCount != server.getConnectedClientsCount())
|
/*if(lastClientCount != server.getConnectedClientsCount())
|
||||||
{
|
{
|
||||||
lastClientCount = server.getConnectedClientsCount();
|
lastClientCount = server.getConnectedClientsCount();
|
||||||
Serial.print("Connected client(s) : ");Serial.println(lastClientCount);
|
Serial.print("Connected client(s) : ");Serial.println(lastClientCount);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// put your main code here, to run repeatedly:
|
// put your main code here, to run repeatedly:
|
||||||
server.runServer();
|
//server.runServer();
|
||||||
webServer.runServer();
|
//webServer.runServer();
|
||||||
debugInfo();
|
debugInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user