Subject RE: [ib-support] Determining if the server is running
Author Pete Bray
> I want to be able to determine if the database
> service is running when the application starts, start the service if
> it's not, and give the user the option to stop the service when
> closing the application.

If your target platform is win9x then you can find out whether the process
is running by either walking the process list using the toolhelp functions,
or using FindWindow() to search for IBserver. If the target is NT etc, then
you can use the ServiceManager to query the status of the IBserver service.
However, if you know that tcp is installed on all your targets then you can
use the excellent Indy components to ping the IBserver port with the
advantage that this code will work for for your current local deployment and
then scale to client/server.

IsServerOK:=false;
TCPping.Host:=Config.ServerName;
TCPping.Port:=3050; //this is the IB service port
try
TCPping.Connect();
except
//catch all socket exceptions, not interested!
end; //of except
if TCPping.Connected then
begin
IsServerOK:=true;
try
TCPping.DisConnect();
except
//catch all socket exceptions, not interested!
end; //of except
end;

to start the ibserver under win9x you'll need to look at the registry to
find the path for ibserver then CreateProcess()

hope this helps,

Kind regards,
Pete