Go Down

Topic: Ethernet shield not allowing repeated connections (Read 2563 times) previous topic - next topic

Gromski

@Paul - I just got my ethernet shield in the post and so I'd be interested (and I'm sure the rest of the forum would too) to see what you did in your source to check for the lock-up

Paul Tanner

OK.  This is not the recommended solution as the libraries ought to be fixed.  What I did was:

         // ready to send something
         while (!client.connect()) {
           digitalWrite(13,HIGH);         // flash LED if it hangs
           delay(200);            
           digitalWrite(13,LOW);
           tries++;
           if (tries > 100) {                 // ok we have problem
             Ethernet.begin(mac, ip);    // solve it by brute force
             tries=0;
           }
         }
         // OK to send now
         client.print("GET /etc...

As I mentioned above this is not the right fix but a reasonable workaround until the libraries get fixed.

GekoCH

#17
Feb 01, 2009, 10:41 pm Last Edit: Feb 01, 2009, 10:47 pm by GekoCH Reason: 1
@Paul Tanner

Could you please post all your changes in the libary.
Because mine still hangs up after 20-30 reconnects
to a PHP site.

Thx
Geko

Paul Tanner

@GekoCH.  I only made one change in the library.  It's the one (posted above) relating to changing the port number.  In the application I made a change that I also posted above.  This is the one about restarting the shield if and when it won't connect.

Please post again here if you have these changes and it still hangs.  We really need help on this from the author of the library or someone familiar with the code.

GekoCH

ok I've changed those things in the libary and made some changes in my sketch.
Every time I send data to my PHP skript I start the Modul again with:
Code: [Select]
Ethernet.begin(mac, ip);
like you've done in your sketch.

Thx
Geko

Go Up