I was trying out this Time NTP sketch: (http://arduino.cc/en/Tutorial/UdpNtpClient?action=sourceblock&num=1). If the ethernet cable is not plugged in, my sketch stays on if (Ethernet.begin(mac) == 0) and never moves on. I figured this would timeout after a while.
I have Arduino 1.01 with a Leonardo and Ethernet shield R3.
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start Ethernet and UDP
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
Udp.begin(localPort);
}