Page 1 of 1

KeepConnectoinAlive?

Posted: Thu 07 Jun 2018 12:59
by kaffeburk
Hello,

(1) I would like to have something like KeepConnectoinAlive in the SSHclient.

(2) If the SSH client is open in design, the program crash when i run it. Is that normal behavior? If SSH is closed it will not crash.

(3) Is it possible to abort the connection from the "before connect" event?

Regards, Pär

Re: KeepConnectoinAlive?

Posted: Fri 08 Jun 2018 10:53
by ViktorV
1. If you want us to add this functionality, please write about it at our User Voice forum: https://devart.uservoice.com/forums/174370-securebridge. If your suggestion gets enough votes, we will consider the possibility of its implementation.
2-3. If the program is written correctly, then when performing the specified actions, it should not crash. If a connection was established in design time, when running a program in runtime, it will attempt to install at startup. You can abort the connection attempt in the BeforeConnect event handler by generating Exception in it. This handler is executed when trying to connect, so please make sure that the correct values ​​are set in it.

Re: KeepConnectoinAlive?

Posted: Mon 11 Jun 2018 05:19
by kaffeburk
Thanx, but how do i abort by generating an exception?

regards, Pär

Re: KeepConnectoinAlive?

Posted: Mon 11 Jun 2018 06:54
by ViktorV
In order for us to give a more accurate and detailed answer, please specify the exact steps to reproduce it.

Re: KeepConnectoinAlive?

Posted: Mon 11 Jun 2018 11:21
by kaffeburk
Step 1, read the line "In order for us to give a more accurate and detailed answer, please specify the exact steps to reproduce it."

Step 2, Read "You can abort the connection attempt in the BeforeConnect event handler by generating Exception in it. This handler is executed when trying to connect, so please make sure that the correct values ​​are set in it."

Step 3, google, look in books you have and find out You don't know how to do that.

Step 4, Now problem reproduced!

Re: KeepConnectoinAlive?

Posted: Mon 11 Jun 2018 11:40
by ViktorV
To abort the connection attempt in the BeforeConnect event handler by generating Exception, you can use the following code:

Code: Select all

procedure TSSHClientFrame.ScSSHClientBeforeConnect(Sender: TObject);
begin
  raise EScError.Create('Connection attempt was aborted');
end;

Re: KeepConnectoinAlive?

Posted: Mon 04 Feb 2019 14:17
by kaffeburk
Hello,

The code You provided have two problems:

(1) It tell the user there is an error. I don't want that. I just want to silent not connect.
(2) When i later try to connect i get an error.

Image

Regards, Pär

Re: KeepConnectoinAlive?

Posted: Mon 04 Feb 2019 14:19
by kaffeburk
Picture of error. I dont know why it dont work but here it is:

https://www.dropbox.com/s/d3rutshgkhwv9 ... t.jpg?dl=0

Re: KeepConnectoinAlive?

Posted: Tue 05 Feb 2019 06:35
by ViktorV
1. To solve your issue you can, for example use the following guidelines:
a)

Code: Select all

procedure TSSHClientFrame.ScSSHClientBeforeConnect(Sender: TObject);
begin
  raise EScError.Create('Connection attempt was aborted');
end;
...
try
  ScSSHClient.Connect;
except
  on E: Exception do
    if E.Message <> 'Connection attempt was aborted' then
      raise;
end;
b)

Code: Select all

procedure TSSHClientFrame.ScSSHClientBeforeConnect(Sender: TObject);
begin
  Abort;
end;
2. In order for us to be able to give you a detailed answer please compose a full sample demonstrating the described behavior and send it to us.

Re: KeepConnectoinAlive?

Posted: Tue 05 Feb 2019 17:40
by kaffeburk
Where do I click to upload a file? nm, i paste the url.

https://www.dropbox.com/s/jptgvmstgszij ... t.rar?dl=0

Step to reproduce:

(1) Enter correct port, userid, password etc for ssh client and connection to your server.
(2) Set the client to connected in design (let it connect).
(3) Run.

If it can "silent" abort before connect and then later manually connect by click "connect" it works. But i get error when i try.

Re: KeepConnectoinAlive?

Posted: Wed 06 Feb 2019 10:55
by ViktorV
This behavior is correct, since most components having properties like BeforeConnect behave this way. This behavior can be reproduced on the standard Delphi component (TClientDataSet).
The correct decision is not to set the Connected property in design time, but work with it in runtime.

Re: KeepConnectoinAlive?

Posted: Wed 06 Feb 2019 14:59
by kaffeburk
I'm trying to fins a way so it dosen''t matter i i forget. As some as i do some changes in design, the connection turns open. I have to manually turn off connection 20 times every day when i work with it. But if not possible then its not possible.

Re: KeepConnectoinAlive?

Posted: Thu 07 Feb 2019 12:27
by ViktorV
Thank you for the interest to our product.
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.