I'm trying to call multiple GET requests to get the pages multiple times in a loop.
But it seems when running again client.connect() returns false. I have also tried running the GET request outside of the if(client.connect()) statement, but no luck (though the GET request sent via ethernet, no server response).
It does seem that client.connected() returns true.
How do you go about running multiple GET requests/connects?
Also I have included the Wireshark packet dump:
http://dl.getdropbox.com/u/263645/Arduino/packetdumpWebClientTest5Oct2009.pcap
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 2 };
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask of the network
byte gateway[] = { 192, 168, 2, 1 }; //your router's IP address
byte server[] = { 74, 52, 17, 79 }; // Google
Client client(server, 80);
void setup()
{
Ethernet.begin(mac, ip, gateway, subnet);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
}
void loop()
{
if (client.connect()) {
Serial.println("connected");
client.println("GET / HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
delay(1000);
client.flush();
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}