@@ -59,10 +59,6 @@ void fetchAsync(const char *host, std::function<void(const StreamString *)> onDo
59
59
60
60
Serial.printf (" [%s] Connecting...\n " , host);
61
61
62
- client->setRxTimeout (20000 );
63
- // client->setAckTimeout(10000);
64
- client->setNoDelay (true );
65
-
66
62
if (!client->connect (host, 80 )) {
67
63
Serial.printf (" [%s] Failed to connect!\n " , host);
68
64
delete client;
@@ -87,25 +83,25 @@ void setup() {
87
83
88
84
// fetch asynchronously 2 websites:
89
85
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) {
92
88
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 ());
94
90
} else {
95
- Serial.println (" [www.google.com ] Failed to fetch website!" );
91
+ Serial.println (" [www.time.org ] Failed to fetch website!" );
96
92
}
97
93
});
98
94
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) {
101
97
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 ());
103
99
} else {
104
- Serial.println (" [www.time.org ] Failed to fetch website!" );
100
+ Serial.println (" [www.google.com ] Failed to fetch website!" );
105
101
}
106
102
});
107
103
}
108
104
109
105
void loop () {
110
- delay (500 );
106
+ delay (100 );
111
107
}
0 commit comments