KeepConnectoinAlive?

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

KeepConnectoinAlive?

Post by kaffeburk » Thu 07 Jun 2018 12:59

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

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: KeepConnectoinAlive?

Post by ViktorV » Fri 08 Jun 2018 10:53

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.

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: KeepConnectoinAlive?

Post by kaffeburk » Mon 11 Jun 2018 05:19

Thanx, but how do i abort by generating an exception?

regards, Pär

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: KeepConnectoinAlive?

Post by ViktorV » Mon 11 Jun 2018 06:54

In order for us to give a more accurate and detailed answer, please specify the exact steps to reproduce it.

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: KeepConnectoinAlive?

Post by kaffeburk » Mon 11 Jun 2018 11:21

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!

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: KeepConnectoinAlive?

Post by ViktorV » Mon 11 Jun 2018 11:40

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;

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: KeepConnectoinAlive?

Post by kaffeburk » Mon 04 Feb 2019 14:17

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

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: KeepConnectoinAlive?

Post by kaffeburk » Mon 04 Feb 2019 14:19

Picture of error. I dont know why it dont work but here it is:

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

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: KeepConnectoinAlive?

Post by ViktorV » Tue 05 Feb 2019 06:35

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.

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: KeepConnectoinAlive?

Post by kaffeburk » Tue 05 Feb 2019 17:40

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.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: KeepConnectoinAlive?

Post by ViktorV » Wed 06 Feb 2019 10:55

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.

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: KeepConnectoinAlive?

Post by kaffeburk » Wed 06 Feb 2019 14:59

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.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: KeepConnectoinAlive?

Post by ViktorV » Thu 07 Feb 2019 12:27

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.

Post Reply