It looks and sounds like you are running out of SRAM. Is this Arduino device an Uno?
Even if it isn't, you should use the F() function to keep your static strings in program memory. That should help. I'll give you one example from your setup code, but you need to go through your code and change all strings like these:
Serial.print(F("server is at "));