Really odd problem.
Arduino 1.0, Mega 2560, Wiznet 5100 Ethernet board.
If I use the WebServer example and connect to the address in my browser I get results back, sometimes it works, sometimes not and sometimes there's lots of junk.
analog input 0 is 1023
and that continues. Other times it's other random characters. I can also ping the IP address.
However if I try any example that uses the EthernetClient client like the WebClient I can't ever get anything to show up in the Serial Monitor. Could something on the Ethernet board be conflicting with it?
If you look at the WebClient example code it should at least write either "Failed to configure Ethernet using DHCP" or "Connecting...". I don't see any way one of those wouldn't write to the Serial Monitor.
Same result with DHCPAddressPrinter. Nada in the Serial Monitor.
I have a Mega and the ethernet shield, and they work well now. It took some debugging to get it that way tho.
A couple things can cause problems like that. The first is the microSD card reader SPI interface. Insure you disable that if you are not using it.
// then do your Ethernet.begin() call
Also, there is the "605 bug".
I do need to use the SD reader in my sketch.
I tried your code and it did fix the problem. Thank you. What are the tricks to using the SD and Ethernet together in the same sketch? I'm going to need to read a file from SD and send the results over the Ethernet.
Then use something like this:
// rest of your setup stuff
Now you should be able to read and write to both devices without manipulating the Slave Select pins. That is accomplished in the libraries of both devices.
The SD.begin() routine returns with its SPI disabled, so nothing is requires there.
The Ethernet.begin() routine returns with its SPI enabled, so you need to disable it.