EldoS | Feel safer!

Software components for data protection, secure storage and transfer

"Connection Lost"

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#10079
Posted: 05/20/2009 09:13:37
by Plusnet GmbH & Co. KG - (Standard support level)
Joined: 02/04/2009
Posts: 12

Hi,

I am using the SSH Blackbox (ElSimpleSSHClientX). When I add a Client-Object to my form and try to connect, it works well. Then I delete the Objects on my Form and add the Base and SSHCli DDLs as a reference to my project. Then I try it this way:

Code
Public Function Execute(ByVal myServer As String, ByVal myUser As String, ByVal myPass As String, ByVal myCommand As String, ByVal Timeout As Integer) As String
    Dim myClient As New SSHBBoxCli7.ElSimpleSSHClientX
    Dim myLicense As New SSHBBoxCli7.ElSSHCliLicenseManagerX
    
    myLicense.SetLicenseKey ("0123456789")

    Dim txtOut As String
    Dim txtErr As String
    Dim txtMerge As String
    Dim StartTime As String
    Dim TargetTime As String
        
    StartTime = Timer
    TargetTime = StartTime + Timeout
    
    txtMerge = ""
    
    myClient.Port = 22
    myClient.Address = myServer
    myClient.UserName = myUser
    myClient.Password = myPass
    myClient.Commands.Add (myCommand)
    myClient.Open
    
    While (myClient.Active = True Or myClient.CanReceive(0) = True) And Timer <= TargetTime
        DoEvents
        If myClient.CanReceive(0) = True Then
            myClient.ReceiveText txtOut, txtErr
            txtMerge = txtMerge & txtOut
        End If
    Wend
    
    Execute = txtMerge
    
    myClient.Close
End Function


I want to do a single remote execution without a object on my form. It works well, too. But when I close Visual Basic 6 then and open my project again I always get the Error: Connection lost (error code is 10058).

I tried to set different properties but it does not get working.

Can you help me?!

dominik
#10084
Posted: 05/20/2009 10:24:00
by Ken Ivanov (EldoS Corp.)

You need at least to set up a handler for ElSimpleSSHClientX.OnKeyValidate event. It is strange that you have the components work from time to time without having this handler assigned.

Besides, please try to handle the OnError, OnAuthenticationSuccess and OnAuthenticationFailed events and check if they are fired. This will help us understand the exact stage of the protocol when the connection is closed.
#10111
Posted: 05/22/2009 00:37:26
by Plusnet GmbH & Co. KG - (Standard support level)
Joined: 02/04/2009
Posts: 12

Hi,

allright, I changed the Class and have now this code:

Code
Dim WithEvents myClient As SSHBBoxCli7.ElSimpleSSHClientX
Dim myLicense As New SSHBBoxCli7.ElSSHCliLicenseManagerX

Public Function Execute(ByVal myServer As String, ByVal myUser As String, ByVal myPass As String, ByVal myCommand As String) As String
    Set myClient = New SSHBBoxCli7.ElSimpleSSHClientX
    
    myLicense.SetLicenseKey ("")

    Dim txtOut As String
    Dim txtErr As String
    Dim txtMerge As String
            
    txtMerge = ""
    
    myClient.Port = 22
    myClient.Address = myServer
    myClient.UserName = myUser
    myClient.Password = myPass
    myClient.Commands.Add (myCommand)
    myClient.Open
    
    While myClient.Active = True Or myClient.CanReceive(0) = True
        DoEvents
        If myClient.CanReceive(0) = True Then
            myClient.ReceiveText txtOut, txtErr
            txtMerge = txtMerge & txtOut
        End If
    Wend
    
    Execute = txtMerge
    
    myClient.Close
End Function


Code
Private Sub myClient_MessageLoop(StopAction As Boolean)
    Debug.Print "myClient_MessageLoop"
End Sub

Private Sub myClient_OnAuthenticationFailed(ByVal AuthenticationType As SSHBBoxCli7.TxSSHAuthenticationType)
    Debug.Print "myClient_OnAuthenticationFailed"
End Sub

Private Sub myClient_OnAuthenticationSuccess()
    Debug.Print "myClient_OnAuthenticationSuccess"
End Sub

Private Sub myClient_OnError(ByVal ErrorCode As Long)
    Debug.Print "myClient_OnError ErrorCode: " & ErrorCode
End Sub

Private Sub myClient_OnKeyValidate(ByVal ServerKey As SSHBBoxCli7.IElSSHKeyX, Valid As Boolean)
    Debug.Print "myClient_OnKeyValidate"
    Valid = True
End Sub


The Debug-Output I get is this:

Quote

myClient_MessageLoop
myClient_MessageLoop
myClient_MessageLoop
myClient_MessageLoop
myClient_OnKeyValidate
myClient_OnError ErrorCode: 6


I hope this can help you to help me :-)

Thanks
Dominik
#10113
Posted: 05/22/2009 01:33:08
by Eugene Mayevski (EldoS Corp.)

Please review your message before you post it. You have posted your license key here which is both unwise and a violation of the license. We will block your key now.


Sincerely yours
Eugene Mayevski
#10114
Posted: 05/22/2009 01:38:46
by Plusnet GmbH & Co. KG - (Standard support level)
Joined: 02/04/2009
Posts: 12

Yes, I know I am sorry. I edited the message es quickly as I can. What does that mean for me now?
#10117
Posted: 05/22/2009 02:42:26
by Ken Ivanov (EldoS Corp.)

Do I understand you right that the very first execution of your project works, while all subsequent attempts to run the command remotely fail?
#10118
Posted: 05/22/2009 02:48:14
by Plusnet GmbH & Co. KG - (Standard support level)
Joined: 02/04/2009
Posts: 12

Not exactly. It is the following:

I open the example Project (Simple Client). There the Eldos objects are linked and placed on a form. I remove the objects and the links from the project. Then I add the Eldos-DLL as a reference in Visual Basic. I do this becouse you can not have both (reference and object-links).

Then I try my function I posted above. It works fine as often as I want. When I then close VB and open it again I get the "Connection Lost"-Error.

No chance to get it working then :-(

Hope you can understand what I am trying to explain. If you dont please ask. I know my english is not the best. Sorry!

Thanks
Dominik
#10119
Posted: 05/22/2009 03:04:17
by Ken Ivanov (EldoS Corp.)

Got it. You should use not the SSHBBoxCli7.ElSSHCliLicenseManagerX component, but the BaseBBox7.ElSBLicenseManagerX for setting the license key. The appropriate fix should resolve the issue.
#10120
Posted: 05/22/2009 03:14:54
by Plusnet GmbH & Co. KG - (Standard support level)
Joined: 02/04/2009
Posts: 12

Hi,

yes you got it! Thank you so much, it works fine now!

Dominik
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

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