Open fredlcore opened 5 years ago
Well i managed to make a "dirty" work around for now. But not really a clean solution! Because it normally poll's for XML data every 2 seconds in my program. I build in a counter, if the counter reaches a certain amount it will call a new function i wrote to make the socketClose public:
void EthernetServer::killsock(uint8_t i) { //Ethernet.socketDisconnect(i); Ethernet.socketClose(i); SerialUSB.println("<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>"); }
By this i'm able to kill the connections. So when the XML isn't polled anymore the counter will go up and activate a killsock command for all 4 ports.
This works for me now, but it is rather nasty and should not be necessary to do so. ;) Would like to know how you fixed it on your end.
I fixed numerous issues in my updated version of the library, which is posted at https://github.com/SapientHetero/Ethernet. README.rtf lists all the changes I made.
Make sure to read the part at the end about manageSockets(), which is where sockets are managed. You'll need to call it in every pass through your webserver in order for it to work. Post any questions as an issue on that page and I'll respond as quickly as possible.
In order to prevent frozen sockets to lockup network connections, this code here used to work until version 1.1.2 (taken from http://forum.arduino.cc/index.php?topic=291958.msg2040300#msg2040300):
After adjusting the includes for 2.0.0, the "
close(i)
" still won't compile because the function is no longer provided for. When I take the 1.1.2 code of "close", the Arduino freezes whereas the same script with library 1.1.2 works perfectly fine.Is there any way to fix this or at least work around it (without downgrading from version 2.0.0)?