mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-05 06:46:31 +02:00
Rework WiFiClient (#238)
* Rework WiFiClient Rework WiFiClient to correct error where making a copy of a WiFiClient object resulted in the socket being closed prematurely. Added loop and select to write to handle/prevent EAGAIN errors. * Rework WiFiClient to use shared_ptr Rework changes to utilize shared_ptr rather than manually maintaining reference count. Revert changes to write * Incorporate comments from review Move WiFiClientSocketHandle and fd() into WiFiClient.cpp
This commit is contained in:
committed by
Me No Dev
parent
770830aa01
commit
f0fc28f0e3
@ -23,11 +23,14 @@
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Client.h"
|
||||
#include <memory>
|
||||
|
||||
class WiFiClientSocketHandle;
|
||||
|
||||
class WiFiClient : public Client
|
||||
{
|
||||
protected:
|
||||
int sockfd;
|
||||
std::shared_ptr<WiFiClientSocketHandle> clientSocketHandle;
|
||||
bool _connected;
|
||||
|
||||
public:
|
||||
@ -69,12 +72,8 @@ public:
|
||||
return !this->operator==(rhs);
|
||||
};
|
||||
|
||||
int fd()
|
||||
{
|
||||
return sockfd;
|
||||
}
|
||||
IPAddress remoteIP();
|
||||
uint16_t remotePort();
|
||||
int fd() const;
|
||||
|
||||
int setSocketOption(int option, char* value, size_t len);
|
||||
int setOption(int option, int *value);
|
||||
int getOption(int option, int *value);
|
||||
@ -82,8 +81,10 @@ public:
|
||||
int setNoDelay(bool nodelay);
|
||||
bool getNoDelay();
|
||||
|
||||
IPAddress remoteIP(int fd);
|
||||
uint16_t remotePort(int fd);
|
||||
IPAddress remoteIP() const;
|
||||
IPAddress remoteIP(int fd) const;
|
||||
uint16_t remotePort() const;
|
||||
uint16_t remotePort(int fd) const;
|
||||
|
||||
//friend class WiFiServer;
|
||||
using Print::write;
|
||||
|
Reference in New Issue
Block a user