Hi folks
I'm a Arduino (also programming) beginner and I have problem connecting Arduino Uno + Enternet Shield with the standard WEB CLIENT Sketch
The program doesn't enter in the "If" condition [client.connect()]but I really don't understand why.
At the same time the WebServer sketch works perfectly....(so I suppose that IP & MAC address are fine)
I'm working inside a private network (so Arduino IP isn't public): could this be a problem on client connection? (even if the server works?)
Anyone could help me?
following the (well known) code:
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10,172,85,203 };
byte server[] = { 209,85,148,106 }; // Google
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
Client client(server, 80);
void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
if (client.connect()) {
//Here where I can't enter in !! 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(;

;
}
}