ethernet webserver works too

This commit is contained in:
technyon
2022-04-29 21:16:09 +02:00
parent 0e9baed3a4
commit 5b12e54be0
12 changed files with 263 additions and 13 deletions

View File

@@ -0,0 +1,56 @@
#include "WifiEthServer.h"
WifiEthServer::WifiEthServer(IPAddress address, int port)
: EthServer(address, port),
_wifiServer(address, port)
{
}
WifiEthServer::WifiEthServer(int port)
: EthServer(port),
_wifiServer(port)
{
}
void WifiEthServer::close()
{
_wifiServer.close();
}
void WifiEthServer::begin(const int port)
{
_wifiServer.begin(port);
}
void WifiEthServer::setNoDelay(const bool value)
{
_wifiServer.setNoDelay(value);
}
EthClient* WifiEthServer::available()
{
if(_wifiEthClient != nullptr)
{
delete _wifiEthClient;
_wifiEthClient = nullptr;
}
_wifiClient = _wifiServer.available();
_wifiEthClient = new WifiEthClient(&_wifiClient);
return _wifiEthClient;
}
void WifiEthServer::discardClient()
{
if(_wifiEthClient != nullptr)
{
delete _wifiEthClient;
_wifiEthClient = nullptr;
}
_wifiClient = WiFiClient();
}