Can't get Webclient to work....

Please help.

I can’t get the WebClient example to work.
I’m using Arduino 016 on a mac.
Board is the Duemilanove 328 + Ethernet shield (W5100)

When I telnet to the server (intern or extern, I’ve tried both) it works just fine…
Also, the Webserver and the chatserver are working just fine…

Here is the code, anyone any idea???

#include <Ethernet.h>

byte mac = { 0xAD, 0x01, 0xBE, 0xEF, 0x3E, 0x00 };
byte ip = { 192, 168, 233, 57 };
byte gw = { 192, 168, 233, 1 };
byte server = { 192, 168, 233, 10 };

Client client(server, 80);

void setup()
{
Ethernet.begin(mac, ip, gw);
Serial.begin(9600);

delay(1000);

Serial.println(“connecting…”);

if (client.connect()) {
Serial.println(“connected”);
client.println(“GET /search?q=arduino HTTP/1.0”);
client.println();
} else {
Serial.println(“connection failed”);
}
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println(“disconnecting.”);
client.stop();
for(;:wink:
;
}
}

What is running on 192.168.233.10 ?

Looks like you are trying the google search example. Google is at 64.233.187.99

on that ip a webserver is running which works perfectly and which I've tried also with telnet I also tried google's ip...

Hmmm. I just ran that example a couple of days ago and it worked for me. I did a side-by-side comparison of the code and the only differences I see are the server IP and the fact that I used the default gateway – neither of which should cause the problem.

I’ll paste in my working code for what it is worth.

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 177 }; // Change this parameters to reflect your network values
byte server[] = { 64, 233, 187, 99 }; // Google

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(115200);

  delay(1000);

  Serial.println("connecting?");

  if (client.connect()) 
  {
    Serial.println("connected");
    client.println("GET /search?q=arduino HTTP/1.0");
    client.println();
  } 
  else 
  {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) 
  {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) 
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

  for(;;)
  ;
  }
}

Oh, and I was using 115200 baud to the serial port.

hmmm... copy/pasted yoru code and still doesn't work.... strange... I'll connect it at home tonight and see whats going on there