MySQL Forums :: Connector/Arduino :: Reconnecting to mysql connector


Advanced Search

Re: Reconnecting to mysql connector
Posted by: Noam Parness ()
Date: January 06, 2014 01:59PM

After another week of playing with it, I have another update:
I think I've narroewed the problem down some more. If the Arduino sends a request to the server, and doesn't get a response in a timely manner, it hangs.
Increasing the MAX_TIMEOUT from 10 to 20 helped some, but it still tends to hang at some point.
I changed my code so that I make the connection to the MySQL server inside the loop, right before I send the query. I then close the connection afterward. Since I only send the query if the connection is successful, I had hoped that would fix the issue for me. It was more stable for a number of hours, but it still hangs if the connection is lost (or times out) after the connection is made - but before the response is recevied by the Arduino.
My programming skills are not all that great, so I can't figure out where it is hanging, other than it seems to be right after the "wait_for_client()" function exits after being called the second time by the "read_packet()" function. (If that doesn't make any sense, then I *really* don't understand the code ;-) ).
I'm guessing that the timeout is creating a state which is not covered by the conditions in the nested functions - so it sits there forever instead of exiting out.

Options: ReplyQuote


Subject Views Written By Posted
Reconnecting to mysql connector 7821 Chris Watters 11/01/2013 01:10AM
Re: Reconnecting to mysql connector 2343 Darlington Adibe 11/01/2013 10:22PM
Re: Reconnecting to mysql connector 2131 Charles Bell 11/06/2013 06:48AM
Re: Reconnecting to mysql connector 1871 Milan Rotovnik 11/06/2013 09:35AM
Re: Reconnecting to mysql connector 1991 Charles Bell 11/07/2013 08:47AM
Re: Reconnecting to mysql connector 1708 Milan Rotovnik 11/11/2013 02:03PM
Re: Reconnecting to mysql connector 2146 Noam Parness 12/18/2013 01:48PM
Re: Reconnecting to mysql connector 1757 Charles Bell 12/18/2013 03:48PM
Re: Reconnecting to mysql connector 1740 Noam Parness 12/29/2013 09:48AM
Re: Reconnecting to mysql connector 1441 Noam Parness 12/30/2013 03:15PM
Re: Reconnecting to mysql connector 1465 Noam Parness 12/31/2013 11:50AM
Re: Reconnecting to mysql connector 1671 Noam Parness 01/06/2014 01:59PM
Re: Reconnecting to mysql connector 1457 Charles Bell 02/04/2014 03:45PM
Re: Reconnecting to mysql connector 1393 Noam Parness 02/04/2014 04:20PM
Re: Reconnecting to mysql connector 1440 Charles Bell 02/05/2014 01:15PM
Re: Reconnecting to mysql connector 1582 Noam Parness 02/05/2014 02:36PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.