Skip to content

Commit

Permalink
[#14] Updated main.cpp to use testAccept
Browse files Browse the repository at this point in the history
Signed-off-by: Clovis Durand <[email protected]>
  • Loading branch information
Clovel committed Dec 12, 2019
1 parent 8d771b6 commit 9e4345b
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions software/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,33 @@ void loop(void) {
Serial.print("[DEBUG] New client, IP : ");
Serial.println(lClient.localIP());

std::string lCurrentLine;
std::string lCurrentLine = "";
int lResult = 0;

/* Loop while the client is connected */
while(lClient.connected()) {
/* Process request */
lResult = acceptRequest(&lClient);
if(0 != lResult) {
Serial.println("[ERROR] Failed to process remote request w/ acceptRequest !");
} else {
Serial.println("[DEBUG] Processed acceptRequest successfully !");
}
// /* Loop while the client is connected */
// while(lClient.connected()) {
// /* Process request */
// lResult = acceptRequest(&lClient);
// if(0 != lResult) {
// Serial.println("[ERROR] Failed to process remote request w/ acceptRequest !");
// } else {
// Serial.println("[DEBUG] Processed acceptRequest successfully !");
// }
// }

lResult = testAccept(&lClient, &lCurrentLine, &sRequest);
if(0 != lResult) {
Serial.println("[ERROR] Failed to process remote request w/ testAccept !");
} else {
Serial.println("[DEBUG] Processed testAccept successfully !");
}

/* Close the client when operation is done */
sRequest = "";
lClient.stop();
Serial.println("Client disconnected.");
Serial.println();

/* Clear the request string */
sRequest = "";

Expand Down

0 comments on commit 9e4345b

Please sign in to comment.