Skip to content

Commit 35b4900

Browse files
committed
Fix example
1 parent 7365136 commit 35b4900

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

examples/FetchWebsite/FetchWebsite.ino

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ void fetchAsync(const char *host, std::function<void(const StreamString *)> onDo
5959

6060
Serial.printf("[%s] Connecting...\n", host);
6161

62-
client->setRxTimeout(20000);
63-
// client->setAckTimeout(10000);
64-
client->setNoDelay(true);
65-
6662
if (!client->connect(host, 80)) {
6763
Serial.printf("[%s] Failed to connect!\n", host);
6864
delete client;
@@ -87,25 +83,25 @@ void setup() {
8783

8884
// fetch asynchronously 2 websites:
8985

90-
// equivalent to curl -v --raw http://www.google.com/
91-
fetchAsync("www.google.com", [](const StreamString *content) {
86+
// equivalent to curl -v --raw http://www.time.org/
87+
fetchAsync("www.time.org", [](const StreamString *content) {
9288
if (content) {
93-
Serial.printf("[www.google.com] Fetched website:\n%s\n", content->c_str());
89+
Serial.printf("[www.time.org] Fetched website:\n%s\n", content->c_str());
9490
} else {
95-
Serial.println("[www.google.com] Failed to fetch website!");
91+
Serial.println("[www.time.org] Failed to fetch website!");
9692
}
9793
});
9894

99-
// equivalent to curl -v --raw http://www.time.org/
100-
fetchAsync("www.time.org", [](const StreamString *content) {
95+
// equivalent to curl -v --raw http://www.google.com/
96+
fetchAsync("www.google.com", [](const StreamString *content) {
10197
if (content) {
102-
Serial.printf("[www.time.org] Fetched website:\n%s\n", content->c_str());
98+
Serial.printf("[www.google.com] Fetched website:\n%s\n", content->c_str());
10399
} else {
104-
Serial.println("[www.time.org] Failed to fetch website!");
100+
Serial.println("[www.google.com] Failed to fetch website!");
105101
}
106102
});
107103
}
108104

109105
void loop() {
110-
delay(500);
106+
delay(100);
111107
}

0 commit comments

Comments
 (0)