I am experiencing the same issues with Mega 2560R2 + Ethernet Shield. I was about to give up until I saw your post. Could you help me understand what steps are exactly necessary to get this fixed? Are any of the code changes checked into githib? If not, could you share with me/us the changed libraries?
If you are talking about just the ethenet shield fix, that is in
/arduino-0022/libraries/Ethernet/utility/w5100.h
Open that file with a text editor. At about line 253, you will see the "old code" I posted above.
Edit to the "new code" and save.
Add: That is all one line of code to the compiler. Insure the backslashes stay intact at the end of each line. The only line that does not have a backslash is after the last curly brace.
1000 thanks to SurferTim, CodingBadly and westfw. Now it works for me too.
@CodingBadly: Thanks for putting the arguments, why I didn't posted any assumed bugfix without getting any confirmation even on the bug itself. They exactly matches my reasons. Plus my assumed bugfix next day turned out to not really do it
SurferTim:
I found it. It was in the w5100.h file starting at line 253 in my version. The new compiler version did not like the old way.
I had (and still have) gcc 4.3.5, and experienced the bug
(I mean the one described in http://arduino.cc/forum/index.php/topic,57972.0.html to avoid confusion). Now I only took your patch from the previous post (w5100.h) and now it works. I did not take earlier mentioned change in socket.cpp.
Even my keep-alive socket connect (for very fast sensor polling) is working now! :)))
If anyone want to see the code (arduino code for the server and java for the client side) just ask for it. I just dont want to flood the board with code nobody wants to see.
This problem was not only on linux, but also on windows (using the libs in the 1.0 beta zip) It wasnt until i found out that available() always returned 1024 that i could properly google for this issue. I can confirm your fix works with the latest AVR Studio 5 (and underlying avr-gcc) on windows. I'm not using arduino's gui as i could not get it to program at all.
Thanks for that report. Maybe we can get a change implemented soon. It has been reported. Maybe if you posted a comment on the change request, it might help. Here is the change request to the Arduino team: http://code.google.com/p/arduino/issues/detail?id=605&start=200
Add: I also changed the topic on the original post to include Windows. That should help other find this.
lemming:
Is this bug fix for W5100.h still required if I am running:
avr-gcc 4.5.3
gcc 4.6.1
and Arduino 1.0?
Maybe not. The gcc had a bug that was causing that problem. The symptoms of this problem would be apparent. In my case, it caused client.available() to return a value larger that 1023, so it would never exit a routine like this:
Im wondering if this is the source of my problem (why I can't get my brand new Nanode working on the Ethernet libs).
I need some time to digest all the info you've posted here....
I have been going mad trying to figure out why I was getting corrupt data from my ethernet board yet I could happily ping it.. it made no sense at all - in my mind if I can get data from a ping request I can get data from any other request.
I have been going mad trying to figure out why I was getting corrupt data from my ethernet board yet I could happily ping it.. it made no sense at all - in my mind if I can get data from a ping request I can get data from any other request.