It continually fails to connect. No matter what I have tried, I always get "connection failed". I thought that maybe the IP address of google was incorrect, so I used the other implementation of client.connect that takes only the domain name. For example, I have tried
But that doesn't work either. I have also verified that the Ethernet cord works by plugging it into another machine. I've pretty much pin-pointed that it is the connectivity of the adapter. Is anyone familiar with setting up the Ethernet on the Galileo? I don't know where to look anymore.
I would start by verifying that your ethernet connectivity is working like this:
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip);
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
You can test success of the connection from the returned result, there are several options to the begin function, you can query the localIP address to confirm connectivity and as per the example above you should wait one second to the connectivity to settle down before attempting a client connection.
CatweazleNZ, thanks for the suggestion. I added that code that you recommended, but client.connect("google.com", 80) continues to fail. It can't connect with either domain name, or ip address. I'm just using the same code as was posted above.
What local IP address is your board getting. You might be able to see it as attached device in your router/modem.
Does the board respond to a ping - test that before and after the ethernet.begin to confirm the basic ethernet connectivity is in place.
Assuming ethernet connectivity is in place you could try sending an email using available example code.
You could also test an incoming client connect - but you need to use the ethernet server class after the ethernet begin and before your ethernetclient. Once again check out available example code.
Good luck?
Catweazle NZ
PS Exactly how much RAM is available on a Galileo for Arduno sketches?
I figured it out. I wasn't waiting long enough after connecting to a given server, so the main body of the loop was getting executed prior to the actual connection being made. Simple fix.
Thanks for your recommendation Catweazle, it helped me better pin-point the issue.