I have a lamp that cycles through rgb colours using pwm. At set intervals it polls my webpage to retrieve an integer x and pulses (up to white and back to the original colour) x times. This is mostly working now but I have a couple of questions regarding programming (and more specifically the ethernet library).
Is there a way to use client.connect() without it holding up the thread? In the loop function I'm checking the display state and seeing whether it needs to update and then performing whatever data access function is needed next. Currently my lamp colour stops cycling for the duration of the connect - usually this isn't that noticable but if it fails to connect it can cause the colour to stick for a while.
I'm also still having a few problems with connections not clearing properly and failing to connect after a while. I've spent quite a lot of time on this problem. I tried a patched copy of the ethernet library and the ethernet2 library but I still have issues. The most stability I've managed to get was by just calling the client.stop() function when I receive the "data finished" character from my site and not trying to reconnect for at least 10 seconds - it's not perfect though. What is the best way to check whether the connection has been properly cleared?