EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SimpleSFTPClient KeepAlivePeriod issue

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#8382
Posted: 12/05/2008 15:51:27
by Kory Sarnelli (Standard support level)
Joined: 12/05/2008
Posts: 10

I recently added a 60000ms KeepAlivePeriod to a SimpleSFTPClient object and now it seems as though when I close my application it has to wait until the keepalive interval is complete. Is there any way around this? I am closing the sftp connection but it seems that the KeepAlive thread must still be running.
#8385
Posted: 12/06/2008 09:26:14
by Kory Sarnelli (Standard support level)
Joined: 12/05/2008
Posts: 10

I also have another (much more simple) question: What unit is the ElSimpleSFTPClient.SocketTimeout property defined in? Seconds, milliseconds? It doesn't say in the help. Thanks!
#8386
Posted: 12/06/2008 09:50:07
by Eugene Mayevski (EldoS Corp.)

All time intervals are in milliseconds.
As for the original question - the timer is stopped in Close method and in destructor. If you are using .NET edition, you might need to explicitly call Dispose method.


Sincerely yours
Eugene Mayevski
#8387
Posted: 12/06/2008 13:32:38
by Kory Sarnelli (Standard support level)
Joined: 12/05/2008
Posts: 10

Yes, I'm using the .NET edition.

I tried calling the Dispose method - I get the same results with an additional error after the delay:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at SBSftp.TElSftpClient.GetActive()
at SBSftp.TElSftpClient.get_Active()
at SBSimpleSftp.TElSimpleSFTPClient.GetActive()
at SBSimpleSftp.TElSimpleSFTPClient.get_Active()
at SBSimpleSftp.TElSimpleSFTPClient.DoSendKeepAlive(Object Sender)
at SBTimer.TElTimer.HandleTimerEvent(Object Sender)
at SBTimer.TTimerThread.DoTimer()
at SBTimer.TTimerThread.Execute()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
#8388
Posted: 12/06/2008 13:44:27
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

As Eugene wrote, timer is automatically disabled and destroyed in TElSimpleSftpClient.Close() method and destructor.
Are you calling the Close method?
And, also, are you using the latest build?
#8389
Posted: 12/06/2008 13:53:20
by Kory Sarnelli (Standard support level)
Joined: 12/05/2008
Posts: 10

Yes, using the latest build. I wrote a quick console app to demonstrate the issue (vb.net 2005):

Code
Imports SBSftpCommon
Imports SBSimpleSftp

Module Module1

    '---------- sftp component methods----------------------
    Private Sub sftp_OnKeyValidate(ByVal Sender As Object, ByVal ServerKey As SBSSHKeyStorage.TElSSHKey, ByRef Validate As Boolean)
        Validate = True 'just a test app, no need to validate
    End Sub

    Private Sub sftp_OnAuthenticationStart(ByVal Sender As Object, ByVal SupportedAuths As Integer)
        Console.WriteLine("Authenticating...")
    End Sub

    Private Sub sftp_OnAuthenticationFailed(ByVal Sender As Object, ByVal AuthenticationType As Integer)
        Console.WriteLine("Authentication failed!")
    End Sub

    Private Sub sftp_OnAuthenticationSuccess(ByVal Sender As Object)
        Console.WriteLine("Authentication successful.")
    End Sub

    Private Sub sftp_OnError(ByVal Sender As Object, ByVal ErrorCode As Integer)
        Console.WriteLine("SFTP error: " + ErrorCode.ToString())
    End Sub
    '--------------/sftp comonent methods----------------------

    Sub Main()

        'connect to sftp server
        SBUtils.Unit.SetLicenseKey("YOUR_KEY_HERE")
        Dim sftp As New TElSimpleSFTPClient
        sftp.Address = "127.0.0.1"
        sftp.Port = 22
        sftp.Username = "test"
        sftp.Password = "test123"
        sftp.KeepAlivePeriod = 10000
        sftp.AuthenticationTypes = 4 'password only
        AddHandler sftp.OnKeyValidate, AddressOf sftp_OnKeyValidate 'handle the key validation/fingerprint checking
        AddHandler sftp.OnAuthenticationStart, AddressOf sftp_OnAuthenticationStart 'successful authentication
        AddHandler sftp.OnAuthenticationSuccess, AddressOf sftp_OnAuthenticationSuccess 'successful authentication
        AddHandler sftp.OnAuthenticationFailed, AddressOf sftp_OnAuthenticationFailed 'failed authentication
        AddHandler sftp.OnError, AddressOf sftp_OnError 'error occured
        sftp.Open()
        sftp.Close(False)
        'sftp.Dispose()

        Console.WriteLine("Done.")

    End Sub

End Module
#8404
Posted: 12/08/2008 08:56:31
by Kory Sarnelli (Standard support level)
Joined: 12/05/2008
Posts: 10

Hi there, any update on this?
#8406
Posted: 12/08/2008 09:12:15
by Eugene Mayevski (EldoS Corp.)

Moved to HelpDesk for investigation.


Sincerely yours
Eugene Mayevski
#11018
Posted: 09/11/2009 03:35:26
by johnny  (Standard support level)
Joined: 08/20/2009
Posts: 19

just for your information I tried above code with VB2008 and it's ok with 60000ms.
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.

Reply

Statistics

Topic viewed 2531 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!