diff --git a/src/WiFiServer.cpp b/src/WiFiServer.cpp index fa72ddca..eea8b79a 100644 --- a/src/WiFiServer.cpp +++ b/src/WiFiServer.cpp @@ -30,15 +30,27 @@ WiFiServer::WiFiServer(uint16_t port) : void WiFiServer::begin() { - begin(0); + beginOpt(0); } uint8_t WiFiServer::beginSSL() { - return begin(SOCKET_FLAGS_SSL); + return beginOpt(SOCKET_FLAGS_SSL); } -uint8_t WiFiServer::begin(uint8_t opt) +void WiFiServer::begin(uint16_t port) +{ + _port = port; + beginOpt(0); +} + +uint8_t WiFiServer::beginSSL(uint16_t port) +{ + _port = port; + return beginOpt(SOCKET_FLAGS_SSL); +} + +uint8_t WiFiServer::beginOpt(uint8_t opt) { struct sockaddr_in addr; diff --git a/src/WiFiServer.h b/src/WiFiServer.h index 22ff743d..1280efa2 100644 --- a/src/WiFiServer.h +++ b/src/WiFiServer.h @@ -30,13 +30,15 @@ class WiFiServer : public Server { private: SOCKET _socket; uint16_t _port; - uint8_t begin(uint8_t opt); + uint8_t beginOpt(uint8_t opt); public: - WiFiServer(uint16_t); + WiFiServer(uint16_t port = 80); WiFiClient available(uint8_t* status = NULL); void begin(); uint8_t beginSSL(); + void begin(uint16_t port); + uint8_t beginSSL(uint16_t port); virtual size_t write(uint8_t); virtual size_t write(const uint8_t *buf, size_t size); uint8_t status();