Skip to content

Commit

Permalink
[#14] Updated htmlSend to use WiFiClient as arg
Browse files Browse the repository at this point in the history
Signed-off-by: Clovis Durand <[email protected]>
  • Loading branch information
Clovis Durand committed Dec 12, 2019
1 parent 7cf4faf commit 34e1d2a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions software/src/webtools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,23 @@ void home(const int pClient);
void togglePage(const int pClient);

/* Functions ------------------------------------------- */
int htmlSend(const int pClient, const char * const pStr) {
int htmlSend(const WiFiClient * const pClient, const char * const pStr) {
int lResult = 0;

errno = 0;
lResult = send(pClient, pStr, strlen(pStr), 0);
lResult = pClient->write(pStr, strlen(pStr));
if(0 > lResult) {
std::cerr << "[ERROR] <htmlSend> send failed with error code " << lResult << std::endl;
if(errno) {
std::cerr << " errno = " << errno << ", " << strerror(errno) << std::endl;
}
}

return lResult;
}

int htmlSend(const int pClient, const std::string pStr) {
int htmlSend(const WiFiClient * const pClient, const std::string pStr) {
int lResult = 0;

errno = 0;
lResult = send(pClient, pStr.c_str(), pStr.length(), 0);
lResult = pClient->write(pStr.c_str(), pStr.length());
if(0 > lResult) {
std::cerr << "[ERROR] <htmlSend> send failed with error code " << lResult << std::endl;
if(errno) {
std::cerr << " errno = " << errno << ", " << strerror(errno) << std::endl;
}
}

return lResult;
Expand Down

0 comments on commit 34e1d2a

Please sign in to comment.