Use libmysqlclient. Write a client to refer to relevant specification before and after mysql_real_connect mysql_init made the following Settings:
Bool reconnect=0;
Mysql_options (db_handle MYSQL_OPT_RECONNECT, & amp; Reconnect);
Unsigned int uTimeOut=1;
Mysql_options (db_handle MYSQL_OPT_CONNECT_TIMEOUT, & amp; UTimeOut);
Mysql_options (db_handle MYSQL_OPT_READ_TIMEOUT, & amp; UTimeOut);
Mysql_options (db_handle MYSQL_OPT_WRITE_TIMEOUT, & amp; UTimeOut);
Disconnect network, when performing a mysql_query, blockages, program will always stuck in here,
Using netstat - an | grep 3306 found on the database machine TCP links have been cut, but in the client's machine in TCP connection is ESTABLISHED,
After about 15 minutes later would perceive a TCP connection interruption,
Consult everybody a great god why!
CodePudding user response:
Add that is testing on ubuntu,CodePudding user response:
Directly using MYSQL itself provides a command line client to try the same query, if there are no interruptions,