@@ -47,30 +47,30 @@ void setup() {
47
47
}
48
48
49
49
void loop () {
50
- for (int i = 0 ; i < 10 ; i++) {
51
- Serial.printf (" Reuse connection example, GET url for the %d time\n " , i + 1 );
52
- int httpCode = http.GET ();
53
- if (httpCode > 0 ) {
54
- Serial.printf (" [HTTP] GET... code: %d\n " , httpCode);
55
-
56
- // file found at server
57
- if (httpCode == HTTP_CODE_OK) {
58
- http.writeToStream (&Serial);
59
- }
60
- } else {
61
- Serial.printf (" [HTTP] GET... failed, error: %s\n " , http.errorToString (httpCode).c_str ());
62
- // Something went wrong with the connection, try to reconnect
63
- http.end ();
64
- http.begin (client, " http://jigsaw.w3.org/HTTP/connection.html" );
65
- // http.begin(client, "jigsaw.w3.org", 80, "/HTTP/connection.html");
66
- }
67
-
68
- Serial.println (" \n\n\n Wait 5 second...\n " );
69
- delay (5000 );
50
+ for (int i = 0 ; i < 10 ; i++) {
51
+ Serial.printf (" Reuse connection example, GET url for the %d time\n " , i + 1 );
52
+ int httpCode = http.GET ();
53
+ if (httpCode > 0 ) {
54
+ Serial.printf (" [HTTP] GET... code: %d\n " , httpCode);
55
+
56
+ // file found at server
57
+ if (httpCode == HTTP_CODE_OK) {
58
+ http.writeToStream (&Serial);
59
+ }
60
+ } else {
61
+ Serial.printf (" [HTTP] GET... failed, error: %s\n " , http.errorToString (httpCode).c_str ());
62
+ // Something went wrong with the connection, try to reconnect
63
+ http.end ();
64
+ http.begin (client, " http://jigsaw.w3.org/HTTP/connection.html" );
65
+ // http.begin(client, "jigsaw.w3.org", 80, "/HTTP/connection.html");
70
66
}
71
67
72
- http.end ();
68
+ Serial.println (" \n\n\n Wait 5 second...\n " );
69
+ delay (5000 );
70
+ }
71
+
72
+ http.end ();
73
73
74
- Serial.println (" Done testing, now wait forever" );
75
- for (;;) delay (100 ); // Wait forever
74
+ Serial.println (" Done testing, now wait forever" );
75
+ for (;;) delay (100 ); // Wait forever
76
76
}
0 commit comments