Ethernet shield unable to connect

Hi I am trying to run the simplepost example included in the twitter library I got a valid token and changed the ip address to match the gateway address but when I loaded the code and ran it the serial monitor displayed "connecting..." for about ten minutes then "failed code:0". No other changes to the code were made, so any hints or suggestions?

Are you able to connect to anything besides twit?

I tried running the Ethernet examples with similar results

Very simple client code you can try:

//zoomkat 4-04-12
//simple client test
//for use with IDE 1.0
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//note that the below bug fix may be required
//the arduino lan IP address { 192, 168, 1, 102 } may need 
//to be modified modified to work with your router.

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan assigned to arduino
//byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
//byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
byte myserver[] = { 208, 104, 2, 86 }; // zoomkat web page server IP address
EthernetClient client;

void setup(){

  Ethernet.begin(mac, ip);
  //Ethernet.begin(mac, ip, gateway, subnet);
  Serial.println("Better client test 4/04/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
    byte inChar; // sets inChar as a byte
    inChar =; //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
      sendGET(); // call sendGET function below when byte is an e


void sendGET() //client function to send/receive GET request data.
  if (client.connect(myserver, 80)) {  //starts client connection, checks for connection
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request
  else {
    Serial.println("connection failed"); //error message if no client connect

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c =; //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 

  client.stop(); //stop client


Didn't I point this out once already?

  //Ethernet.begin(mac, ip, gateway, subnet);

Ethernet.begin(mac, ip, dns, gateway, subnet); or, if not using dns Ethernet.begin(mac, ip, gateway, gateway, subnet);

But it is not your fault. The ethernet reference page is incorrect, so I filed a bug report:

Didn't I point this out once already?

Sure, but in some instances all the declarations are not needed. If you call them in the ethernet startup, they have to be previously declaired, which can cause confusion and errors for newbies trying to get something that works. You are in the mind set that if one tire on your car gets bald, all four must be replaced. if all the declarations are needed, use them. If not needed, don't use them unless you really want to for what ever reason. :)