I have a sketch which uses EthernetClient to send emails. This will reliably send emails every hour (for maybe 2 weeks !!) and then it fails !! I have added statements to dns.cpp and EthernetClient.cpp and have now trapped the error route.
After a successful return from getHostByName(), EthernetClient::connect(IPAddress id, uint16_t port) is called. I don't understand the first statement (viz. if (_sock != MAX_SOCK_NUM) return 0; and thus return failure ..... !!)
There are very few comments, so I'm struggling to understand this failure.
Can anybody enlighten me as to why this constitutes a failure ? (I'm probably being stupid ...... !!)
EDIT: Forgot to mention that once the failure occurs, it is permanent i.e. all following attempts to send an email result in the same "error" if (_sock != MAX_SOCK_NUM) return 0