Ethernet shield not reconnecting

Hi there,

I have an Uno with Ethernet shield, both from a Sparkfun kit. I have the Ethernet shield connected through my macbook's wifi.

When I enabled internet sharing on the laptop and fire up the Arduino, I get an IP, it connects and pulls the file I need via HTTP. However, if I reset the Arduino, it keeps it's IP address but will not connect to any outside servers. If I reset the internet sharing and the Arduino, it comes back.

I originally saw this when using my Squeezebox as a bridge and switched over to the MacBook. I also tried this on two different generations of MacBooks with the same results.

Has anyone else had similar experiences? Any recommendations?

Thanks.
-P.

Update: I tried to specify the IP, gateway, etc. with the same outcome. It connects on the first go, but then not again. Using Wireshark, I took a look at the packets. The SYN is being sent to the remote server, with the correct gateway header. However, nothing is making it back. I would think this a Mac issue, except I saw the same with my Squeezebox.

I inadvertently resolved my problem.

I had a function that would open the connection and send through the HTTP data. For my testing purposes, I called that function from setup().

I adding time delay checking and moved it into the loop() and now it works like a champ.

Any ideas why that might have been the case?

Thanks.

I had a function that would open the connection and send through the HTTP data. For my testing purposes, I called that function from setup().

I adding time delay checking and moved it into the loop() and now it works like a champ.

Any ideas why that might have been the case?

I had some code that I don't want to show you that caused my Arduino with Ethernet shield to behave strangely. Can you tell me why?