My arduino client is sending http request to my server every minutes. (Actually there are two http request in every minutes- one to get some data and one to execute a php script. I have been getting a warning message in mysql. After hours of searching I came to a conclusion that client.stop() at the end of the http request is not closing the connection. (That is the basic reason for the warning). I have seen that some people reported the same error before. Any suggestions please
//error message. it goes on ever minutes- 2 warnings per minutes- 2 http requests!
2019-08-27 10:35:26 32 [Warning] Aborted connection 32 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
2019-08-27 10:35:26 35 [Warning] Aborted connection 35 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
2019-08-27 10:36:26 36 [Warning] Aborted connection 36 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
2019-08-27 10:36:26 39 [Warning] Aborted connection 39 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
dayDreamer1013:
My arduino client is sending http request to my server every minutes. (Actually there are two http request in every minutes- one to get some data and one to execute a php script. I have been getting a warning message in mysql. After hours of searching I came to a conclusion that client.stop() at the end of the http request is not closing the connection. (That is the basic reason for the warning). I have seen that some people reported the same error before. Any suggestions please
//error message. it goes on ever minutes- 2 warnings per minutes- 2 http requests!
2019-08-27 10:35:26 32 [Warning] Aborted connection 32 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
2019-08-27 10:35:26 35 [Warning] Aborted connection 35 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
2019-08-27 10:36:26 36 [Warning] Aborted connection 36 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
2019-08-27 10:36:26 39 [Warning] Aborted connection 39 to db: 'unconnected' user: 'root' host: '192.168.xx.xxx' (Got an error reading communication packets)
I used the program from https://arduinojson.org/v5/example/http-client/
add client.stop() to all 'exits'. now it si closed only on sucess
client.stop() at the end of the http request is not closing the connection
it will close the connexion but a client is considered connected if the connection has been closed but there is still unread data. Just empty the stream before closing:
while (client.available()) client.read();
client.stop();
J-M-L:
it will close the connexion but a client is considered connected if the connection has been closed but there is still unread data. Just empty the stream before closing:
while (client.available()) client.read();
client.stop();
or faster
while (client.read() != -1);
client.stop();
connected() returns true if data are available, but it has no implication for stop()
It still uses “an instance” - not sure how they are garbage collected / cleaned up or if there is a cap to the number of client that can hang around (would need to check source code one of those days)
J-M-L:
It still uses “an instance” - not sure how they are garbage collected / cleaned up or if there is a cap to the number of client that can hang around
after stop() the data are not available.
the buffers are in the Wiznet chip