Additions to WiFiClient and WiFiServer (#404)
Required for WebServer and/or DNSServer libraries
This commit is contained in:
parent
6af648e8f5
commit
b05c7dfa59
@ -224,6 +224,11 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t WiFiClient::write_P(PGM_P buf, size_t size)
|
||||||
|
{
|
||||||
|
return write(buf, size);
|
||||||
|
}
|
||||||
|
|
||||||
int WiFiClient::read(uint8_t *buf, size_t size)
|
int WiFiClient::read(uint8_t *buf, size_t size)
|
||||||
{
|
{
|
||||||
if(!available()) {
|
if(!available()) {
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
int connect(const char *host, uint16_t port);
|
int connect(const char *host, uint16_t port);
|
||||||
size_t write(uint8_t data);
|
size_t write(uint8_t data);
|
||||||
size_t write(const uint8_t *buf, size_t size);
|
size_t write(const uint8_t *buf, size_t size);
|
||||||
|
size_t write_P(PGM_P buf, size_t size);
|
||||||
int available();
|
int available();
|
||||||
int read();
|
int read();
|
||||||
int read(uint8_t *buf, size_t size);
|
int read(uint8_t *buf, size_t size);
|
||||||
@ -84,6 +85,10 @@ public:
|
|||||||
IPAddress remoteIP(int fd) const;
|
IPAddress remoteIP(int fd) const;
|
||||||
uint16_t remotePort() const;
|
uint16_t remotePort() const;
|
||||||
uint16_t remotePort(int fd) const;
|
uint16_t remotePort(int fd) const;
|
||||||
|
IPAddress localIP() const;
|
||||||
|
IPAddress localIP(int fd) const;
|
||||||
|
uint16_t localPort() const;
|
||||||
|
uint16_t localPort(int fd) const;
|
||||||
|
|
||||||
IPAddress localIP() const;
|
IPAddress localIP() const;
|
||||||
IPAddress localIP(int fd) const;
|
IPAddress localIP(int fd) const;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <lwip/netdb.h>
|
#include <lwip/netdb.h>
|
||||||
|
|
||||||
#undef write
|
#undef write
|
||||||
|
#undef close
|
||||||
|
|
||||||
int WiFiServer::setTimeout(uint32_t seconds){
|
int WiFiServer::setTimeout(uint32_t seconds){
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -103,8 +104,16 @@ bool WiFiServer::hasClient() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WiFiServer::end(){
|
void WiFiServer::end(){
|
||||||
close(sockfd);
|
lwip_close_r(sockfd);
|
||||||
sockfd = -1;
|
sockfd = -1;
|
||||||
_listening = false;
|
_listening = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WiFiServer::close(){
|
||||||
|
end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WiFiServer::stop(){
|
||||||
|
end();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ class WiFiServer : public Server {
|
|||||||
using Print::write;
|
using Print::write;
|
||||||
|
|
||||||
void end();
|
void end();
|
||||||
|
void close();
|
||||||
|
void stop();
|
||||||
operator bool(){return _listening;}
|
operator bool(){return _listening;}
|
||||||
int setTimeout(uint32_t seconds);
|
int setTimeout(uint32_t seconds);
|
||||||
void stopAll();
|
void stopAll();
|
||||||
|
Loading…
Reference in New Issue
Block a user