Go Down

Topic: Arduino Ethernet stops working with EthernetServer declared (Read 206 times) previous topic - next topic

mrmarbury

Hi,

the Arduino Ethernet R3 that I've got is generally working. I can make LEDs blink and I can create a simple program to ping it:

Code: [Select]

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

byte mac[] = {  0x90, 0xA2, 0xDA, 0x0D, 0x8E, 0xDF };
IPAddress ip(10,0,0,178);
IPAddress gw(10,0,0,1);
IPAddress mask(255,255,255,0);

void setup() {
  Ethernet.begin(mac,ip, gw, mask);
}

void loop() {

  } 
}


With this I can ping it and nmap tells me the host is up though there are no open ports. Well, let's go on and create a server.

So I make the code look like this:

Code: [Select]

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

byte mac[] = {
  0x90, 0xA2, 0xDA, 0x0D, 0x8E, 0xDF };
IPAddress ip(10,0,0,178);
IPAddress gw(10,0,0,1);
IPAddress mask(255,255,255,0);

EthernetServer tempServer = EthernetServer(80);

void setup() {
  Ethernet.begin(mac,ip, gw, mask);
  tempServer.begin();
}

void loop() {
  EthernetClient client = tempServer.available();
  if (client == true) {
    tempServer.write(client.read());
  }
 
}


As soon as I upload this, the Arduino Ethernet is neither "nmapable" nor pingable

Can somebody tell me what is wrong here? I don't have to declare everything. As soon as I add "EthernetServer tempServer = EthernetServer(80);" to the first example, it stops working.

I'm using Arduino 1.0.3-r1 on Gentoo. I already programmed several Uno's with this Version so in general it's working.

Thx for your help.

Cheers,
Stefan

mrmarbury

Well, figured it out. Seems like there is a bug in the sources that come with Gentoo? Downloaded 1.0.2 from the Arduino site and it's working ^^

So never mind.

Cheers,
Stefan

Go Up