Erledigt !TCP Client DHCP code

Abend,
ich habe den Code von hier:
http://www.lauridmeyer.com/2012/04/simple-arduino-tcp-client-using-the-ethernetshield-dhcp-and-a-java-server/

Es soll die Nachricht "Hello Server" an Server gesendet werden,leider ist da ein Problem mit dem DHCP :frowning:

Ich habe die IP und Port an meinen Server angepasst,jedoch bekomme ich nichteinmal eine IP zugewiesen.
Was ist an dem code falsch?

#include <SPI.h>
#include <Ethernet.h>
 
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress serverIP(192,168,178,22); // IP Adress to our Server
int serverPort=54711;
 
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to
EthernetClient client;
 
void setup() {
  // start the serial for debugging
  Serial.begin(9600);
  // 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:
    for(;;)
      ;
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("connecting to Server ...");
 
  // if you get a connection to the Server
  if (client.connect(serverIP, serverPort)) {
    Serial.println("connected");//report it to the Serial
    String msg="Hello Server";//Message to be sent
    Serial.println("sending Message:"+msg);//log to serial
    client.println(msg);//send the message
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}
 
void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
 
  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();//report it to the serial
    Serial.println("disconnected");
    client.stop();
 
    // do nothing forevermore:
    for(;;)
      ;
  }
}

mfg.
Hasutechno

Muss das so?

 // do nothing forevermore:
    for(;;)
      ;

hmm,
ne hab auch ohne probiert,ich bekomme keine ip per dhcp

ich hab die ethernet lib neu runtergeladen,jetzt lüppts :wink:

Mfg.
Haustechno