Go Down

Topic: Ethernet shield problems! Time to update library? (Read 23 times) previous topic - next topic


Well I set up my network the same as you listed and tested your sample telnet server code and it worked fine with both the original and improved Ethernet library. My test was even done on a MacBook Pro with OSX Leopard.

So either you have a defective ethernet shield (unlikely), or there's still some problem in your network.

Some more questions (including some you didn't answer last time around):
  • What LED's are lit solidly on the Ethernet shield when it's idle?
  • When you ping the address you assigned the Ethernet Shield from your MacBook, do you get a response? If so, copy the result in your reply.
  • What Arduino board and chip are you using?

Jose Bastos

Similar with the problem of the client that hangs if more than 4 connections are open simultaneously, I have the same problem setting up a server that has several simultaneous requests.

The server sends RST packets to the extra connections, but forgets to close correctly the 4 connections leaving then  half closed in the CLOSE_WAIT state. Therefore the server hangs forever with all sockets in use.

The following patch in Server.cpp (arduino 0017)

[font=Courier]void Server::begin()
 for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
   Client client(sock);
   if (client.status() == SOCK_CLOSED || client.status() == SOCK_FIN_WAIT || client.status() == SOCK_CLOSE_WAIT) {
     socket(sock, Sn_MR_TCP, _port, 0);
     EthernetClass::_server_port[sock] = _port;

and moving server.begin() from setup to the main loop as shown below in the WebServer example seems to solve the problem

* Web Server
* A simple web server that shows the value of the analog input pins.

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };

Server server(80);

void setup()
 Ethernet.begin(mac, ip);

void loop()
 Client client = server.available();
 if (client) {
   . . .



Any updates on how this is working for you?  I just made these changes as well...

Jose Bastos

I ended up patching Client.cpp and Server.cpp (delivered with software version 0017).

arduino+ethershield have been running non stop for several months now.

You can get the patched code here


Aug 20, 2010, 05:09 am Last Edit: Aug 20, 2010, 05:11 am by Mavromatis Reason: 1
Do you guys know how we can use the full 8k of RX buffer of the W5100 chip?  Seems like we are set at 2048 for up to 4 socket connections.  Can we go 4k on two sockets max instead?  How can I make these changes?  

Here are some more details in this post: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1282169385

Go Up