[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql-plusplus
Subject: Re: how to detect mysqld that it's running
From: Warren Young <warren () etr-usa ! com>
Date: 2003-10-14 23:45:45
[Download RAW message or body]
/// Blue Sunshine /// wrote:
> but it's not work... it's hang at 'con.connect(...)'
Are you sure it's hung, and not that connect() is just taking more time
than you like to time out? Many implementations of connect() wait 60
seconds before timing out. Even a connection to localhost may run
across this with some firewall configurations.
> what should i do?
You could write a little bit of nonblocking sockets code to call
connect() then select() with a shorter timeout. If there is a program
listening on port 3306, you can reasonably guess that the database is up
and running. If there is nothing listening, the timeout will occur, and
you can assume that the database is not running.
Be wary of the dangers of setting the timeout too low. On a busy system
or across a busy network, a 50-second connect time may be typical.
--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsub=mysql-plusplus@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic