Mega 2560 + WiShield - client.available() issues

Hello,

When trying to run a simple get program, I ran into issues while trying to process the get request.
In a simple nested loop example, like this:
while(client.connected()){
while (client.available()) {
char c = client.read();
Serial.println(c);
}
}
The client.connected() evaluates as true, but the client.available() -which returns how many bytes I have available for reading- returns 0. Why do I not have any available space? Do I need to use an SD card?

thanks

Why do I not have any available space?

If connected() returns true, and available() returns 0, it means that the Arduino is waiting for the server to supply a response that can be read.

What are you connecting to? What GET request did you make? What response is that server/script returning?

The available() method says nothing about space.

servername is: char servername[]="www.arduino.cc";

if (client.connect(servername, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /latest.txt HTTP/1.1");
client.println("Host: www.arduino.cc");
client.println("User-Agent: arduino-ethernet");
client.println("Connection: close");
client.println();

while(client.connected()) {
//Serial.println(client.connected());
Serial.println(client.available());
while (client.available()) {
// client.setTimeout(2000);
char c = client.read();
Serial.println(c);
}
}

I am just trying ot get the source from the page: http://www.arduino.cc/latest.txt

The Host, User-Agent, and Connection statements are not needed.

Do you have DNS enabled, outside that snippet? If not, you need to use IP addresses, not host names.

sorry, apparently there are just problems between the wifi shield and mac OSX. Tried it on a windows machine and it worked. Thanks