newbie problem

hi there

i have a problem..
this is my code:

#include <SPI.h>
#include <Ethernet.h>
#include "DHT.h"
#include <IRremote.h>
#include "ir.h"

#define DHTPIN 2     // DTH Sensor
#define DHTTYPE DHT22   // DHT 22  (AM2302)

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(10,86,100,201);
IRsend irsend;
EthernetServer server(16123);
DHT dht(DHTPIN, DHTTYPE);

void setup()
{
//  Serial.begin(9600);
//  while (!Serial)
//  {
    ; // wait for serial port to connect. Needed for Leonardo-Board only
//  }

  Ethernet.begin(mac, ip);
  server.begin();
  dht.begin();
//  Serial.print("server is at ");
//  Serial.println(Ethernet.localIP());
}


void loop()
{
  float h; 
  float t;
  
  EthernetClient client = server.available();
  if (client)
  {
//    Serial.println("new client");
    h = dht.readHumidity();
    t = dht.readTemperature();

    // isNaN (not a number)
    if (isnan(t) || isnan(h))
    {
//      Serial.println("ERROR: Failed to read from DHT");
    }

    String clientMsg = "";
    String clientbuffer = "";
    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();
        clientMsg += c;
        client.print(c);
  //      Serial.println(clientMsg);
        if (c == '\n') // Zeilenende: \n
        {
          clientMsg.toUpperCase();
          if (clientMsg.startsWith("GET "))
          {
            if (clientMsg.substring(4,9) == "KLIMA" )
            {
              client.print("Temperature:");
              client.println(t);
              client.print("Humidity:");
              client.println(h);
            }
          }
         if (clientMsg.startsWith("PUT "))
          {
            client.print("PUT: ");
            clientbuffer = clientMsg.substring(4,8);
            client.println(clientbuffer);
              if (clientbuffer == "IR P")
              {
                irsend.sendRaw(S_pwr,68,38);
              }
              if (clientbuffer == "IR 1")
              { client.println("jap");
                irsend.sendRaw(S_1,68,38); irsend.sendRaw(S_1,68,38); irsend.sendRaw(S_1,68,38);
              }              
              if (clientbuffer == "IR 2")
              {
                irsend.sendRaw(S_2,68,38);
              }
/*              if (clientbuffer == "IR 3")
              {
                irsend.sendRaw(S_3,68,38);
              }
              if (clientbuffer == "IR 4")
              {
                irsend.sendRaw(S_4,68,38);
              }
              if (clientbuffer == "IR 5")
              {
                irsend.sendRaw(S_5,68,38);
              }
              if (clientbuffer == "IR 6")
              {
                irsend.sendRaw(S_6,68,38);
              }
 */             if (clientbuffer == "IR 7")
              {
                irsend.sendRaw(S_7,68,38);
              }
              if (clientbuffer == "IR 9")
              {
                irsend.sendRaw(S_9,68,38);
              }
              if (clientbuffer == "IR 0")
              {
                irsend.sendRaw(S_0,68,38);
              }
              
              clientbuffer = "";
          }
         
          if (clientMsg.startsWith("BYE")) // byebye und tschüss
          {
            client.stop();
          }          
          
          clientMsg = "";
          delay(10);
          client.stop();
        }
      }
    }
    delay(10);
    client.stop();
//    Serial.println("client disonnected");
  }
}

this works fine..
but if i remove the comment (/* ........ */) am unable to connect to the arduino.. then, i comment out the same code, i am can connect... i have tested it 10x..
why? - This confuses me.. it's the same.. i can't understand this..

why? - This confuses me.. it's the same.. i can't understand this..

It ISN'T the same. Every if statement adds more code/uses more memory. You (still) only have a limited amount of it. When you've overfilled it, strange things happen. Get a Mega; get more memory.

The Ethernet library uses a lot of memory, but the code is still small.
It should easily fit into a Arduino Uno.

The String class seems to be the problem.
Can you use old style arrays as buffers and 'C' string functions ?

it's a atmega328 (arduino duemillanove).
ok. i can try it with ansi C char array's.

is it really possible that the memory is to small? - my program will be much bigger.. it's only the first part.
is there an other arduino with much more memory.. or is there another way...?

thanks.

is there an other ardunio with much more memory

The Mega has 8K. The DUE has 96K. By contrast the 328-based Arduinos have 2K.

you're right..
i used this code from Arduino Playground - AvailableMemory to test it.

i buy something with a mega 2560.

thanks