Page 1 of 1

Ping method in TMSConnection - example of use.

Posted: Tue 24 Dec 2013 20:28
by akm
Hi
Give me a small example of use newly added Ping method,
because in doc I can only read, that this method was added.

Re: Ping method in TMSConnection - example of use.

Posted: Wed 25 Dec 2013 07:35
by AndreyZ
Hello,

You can use the Ping method in the following way:

Code: Select all

MSConnection.Ping;
The Ping method can be used for the following tasks:
- to check availability of the server;
- to avoid automatic disconnection of the client by the server.

Re: Ping method in TMSConnection - example of use.

Posted: Wed 25 Dec 2013 08:25
by akm
Hm, Ping isn't return any value (void __fastcall Ping(void);)
May be this method fire some events on TMSConnection?

Re: Ping method in TMSConnection - example of use.

Posted: Wed 25 Dec 2013 08:33
by AndreyZ
If a server is not available, the Ping method raises an exception (that is actually raised by the used provider, OLEDB or SQL Native Client).

Re: Ping method in TMSConnection - example of use.

Posted: Wed 25 Dec 2013 10:48
by akm
OK
Is the right way to use Ping() method like in following example?

Code: Select all

try {
     MSConnection->Ping();
}
catch (exception &Exception)
{
    case (Exception)
      switch Exc1:
          DoSomething();
          break;
      switch Exc2:
          DoSomethingElse();
          break;
    end
}

Re: Ping method in TMSConnection - example of use.

Posted: Wed 25 Dec 2013 13:51
by AndreyZ
Yes.