Netserver example is not working here with the Duemilanove

I had the Duemilanove and Ethernet shield together in front of me, and tried some examples from Arduino web site and IDE. Ethernet client seems to work and DHCP, but the server does not. That is a pity, because that would interest me most

The shield is an old card too, it does not have HW for the SD card. It uses a Wiznet W5100 chip. I have no extra power, just the USB, but other examples work with it, so should the shield too?

Try this server code.

I tried but it did not work. But can you make it print it's IP address. Because I got the examples working by using Ethernet.begin(mac); But then I had to use whatever IP it got. I come here to write a new post about that. I dont know why it works but I sure would like to know.

You should get into your router and see what ip address/subnet it is using for the localnet. Then check the dhcp server settings and see what ip addresses it will issue. You should use a static ip that is in the subnet of the router's ip, but not in the dhcp server range.

If you have a challenge with that, post the make and model of the router you are using.

That is when my local net is using for the shield when it works, I should give it an address starting with or . I'll try that.

My modem is Bewan ibox IAD ARV4510NPW

I tried to use for both sketches and they did not work. Then without the IP part the example from Arduino IDE worked. The code from Arduino playground did not do anything visible either way.

By the way, is this correct? Ethernet.begin(mac, ip, [u]gateway, gateway[/u], subnet); The Gateway is there twice. This is from the playground sketch.

Below is some simple code I modified to try to match the ip address you posted. Post the code in the IDE and upload, start the serial monitor, then click on the blue http url in the code posted in the IDE.

//zoomkat 3-1-12
//simple button GET for pin and servo control
//for use with IDE 1.0
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html 
//address will look like when submited
//for use with W5100 based ethernet shields

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

#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 100, 16 }; // ip in lan
byte gateway[] = { 192, 168, 100, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port

String readString; 


void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);

  myservo.write(90); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo co
  //enable serial data print 
  Serial.println("server LED test 1.0"); // so I can keep track of what is loaded

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c =;

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 

        //if HTTP request has ended
        if (c == '\n') {

          Serial.println(readString); //print to serial monitor for debuging 

          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");

          client.println("<TITLE>Arduino GET test page</TITLE>");

          client.println("<H1>Zoomkat's simple Arduino button</H1>");
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?off');\"/>");        
          //stopping client

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
            digitalWrite(5, HIGH);    // set pin 4 high
            Serial.println("Led On");
          if(readString.indexOf("off") >0)//checks for off
            digitalWrite(5, LOW);    // set pin 4 low
            Serial.println("Led Off");
          //clearing string for next read


That is a nice little program and it works. Great. Funny thing is, buttons work with IE but not in Firefox.

What is different here. Was it just the IP?

What is different here. Was it just the IP?

Yes. But this part of zoomkat's code is not correct.

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

Otherwise you will not be able to access anything outside your localnet.

Which way it is. At first glance I thought it was Ethernet.begin(mac, ip, gateway, subnet); Is it really necessary to have the subnet field twice?

LMI: Which way it is. At first glance I thought it was Ethernet.begin(mac, ip, gateway, subnet); Is it really necessary to have the subnet field twice?

Actually, it is this format, but if you are not using dns, you can use the gateway ip as a "placeholder".

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