EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Verify Connection Status

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#21235
Posted: 08/29/2012 10:28:13
by fidel pd (Basic support level)
Joined: 07/11/2012
Posts: 7

Hello,

I am using TElSimpleSFTPClient to open a SFTP connection. The connection opens correctly and the method SftpClient_OnAuthenticationSuccess is fired. My problem is that if the connection with the server is broken the OnError method is not fired. Until I make a call to a method of TElSimpleSFTPClient (UploadFile, DownloadFile, ListDirectory ...) I do not know if the connection is open. Is there any property that check if the connection is open?

Looking at the API I thought that the "TElSimpleSFTPClient.Active" property would give me this information, but this property is always active after a successful connection.

Thank you in advance.
#21236
Posted: 08/29/2012 11:10:07
by Eugene Mayevski (EldoS Corp.)

The only way to determine activity of the socket connection (and consequently of SFTP connection) is to send something. TCP layer will return an error if sending fails. You can use RequestAbsolutePath command to test connectivity without causing significant traffic.

Also you can use KeepAlivePeriod property to send commands periodically keep the connection opened. Yet this is slightly different to what you need as it doesn't report connection errors.


Sincerely yours
Eugene Mayevski
#21267
Posted: 08/30/2012 07:56:10
by fidel pd (Basic support level)
Joined: 07/11/2012
Posts: 7

Hello,

I have been reading the documentation in order to resolve the problem explained above. In the documentation there are three parameters that I think they would be suitable to check the connection status: TElSimpleSFTPClient.Active, TElSimpleSFTPClient.LastSyncComment and TElSimpleSFTPClient.LastSyncError.

I have checked these parameters during all states of a connection (binding, openning, closing) and I have detected that these parameters are not updated in the case of an error happens or the connection status changes.

Could you help me to resolve the error?

Thank you in advance.
#21268
Posted: 08/30/2012 07:59:20
by Eugene Mayevski (EldoS Corp.)

Did you read my answer above?

The ONLY way to detect connection state in TCP is to SEND something and check the outcome. This is irrelevant to our components - this is how TCP works.

For more details read here. This is a long and complicated reading though.


Sincerely yours
Eugene Mayevski
#21269
Posted: 08/30/2012 08:02:05
by Eugene Mayevski (EldoS Corp.)

Also here, question 2.14.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 783 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!