Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFiServer::begin(port) and ctor without parameters #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/WiFiServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 4 additions & 2 deletions src/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down