EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SimpleSSH does not work in latest

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 06/04/2007 12:10:24
by Jeff Lindborg (Basic support level)
Joined: 06/12/2006
Posts: 26

Hey folks.

I upgraded to the latest version this morning (I had been running the version I downloaded in December of last year). All my apps that used the simpleSSH control stopped working (SFTP continues to work fine). So I took a look at your sample apps - the simpleSSH sample provided also has the same problem.

Basically you can connect and issue the first command and all is well - after that, however, it seems to do some sort of weird "caching" thing where it doesn't issue the command you just gave it, but instead spits out some of the results from the previous command. For instance if you do an "ls -l" and it's a long list, it wont come back to the prompt - so if you issue a "cd ..", what you see coming out in the results window is more from the ls -l command. Kind of weird.

I'm using the ActiveX version of the control and this repros with your sample on both my boxes - I already checked for other instances of any of your DLLs and there are none so it looks to be just a straight up problem with the simpleSSH interface.

If you guys need logs or something, let me know - hopefully you can see the same thing there by trying it.

edit - just a follow up - the ElSSHClientX control example seems to work ok in the same test, this seems to be specific to the ElSimpleSSHClientX control.
Posted: 06/04/2007 12:24:11
by Eugene Mayevski (EldoS Corp.)

The thing is that the data is not read completely from the output. Can you please post the piece of code that performs reading?

Sincerely yours
Eugene Mayevski
Posted: 06/04/2007 12:30:00
by Eugene Mayevski (EldoS Corp.)

Indeed, I can reproduce your problem, so we will work on it immediately.

Sincerely yours
Eugene Mayevski
Posted: 06/04/2007 12:34:58
by Eugene Mayevski (EldoS Corp.)

Found it. In fact there's no problem there (except in the sample itself). In the sample the data is read from the incoming connection using a single call to ReceiveText after OnDataArrival event. This is not correct. You should create a timer and attempt to read the data in response to timer event.

Sincerely yours
Eugene Mayevski
Posted: 06/04/2007 12:43:18
by Jeff Lindborg (Basic support level)
Joined: 06/12/2006
Posts: 26

Really? This is a pretty major change in behavior for your control to fly by without a big call out. All my apps I've been using for almost 2 years now work fine with the older version of your DLLs and now I need to go change them all to stick in a timer here? That just does not seem right... the receive text should clear the buffer and the DataArrival even should be fired again if there is still data coming in. I'm a bit perplexed why you'd need folks to stick in a timer and manually loop around until it's done. That seems pretty weak to me.
Posted: 06/04/2007 13:06:15
by Eugene Mayevski (EldoS Corp.)

The timer is needed always -- the system doesn't notify you when there's something in the socket to receive. You need to ask the socket if anything can be received. With SSH, where the data can arrive at any moment, you need to ask the system for incoming data from time to time. So OnDataArrival is a secondary source of information. The primary one is a timer.

In fact, Socket_OnDataArrival event handler (in the sample) belongs to the VB socket implementation. It's not SimpleSSHClient's thing.

When you use built-in socket of ElSimpleSSHClient, it doesn't have such event and a timer is your *only* option. The control was created as such from the very beginning.

Now about the implementation of OnDataArrival event handler. You can live without OnTimer but you need to ensure that you read all data from the buffer. The sample calls ReceiveText just once, but ReceiveText returns only part of the text (max. 16 Kb). So when you call ReceiveText until it returns empty string. Here's the modified method from the sample:


Private Sub ClientSocket1_DataArrival(ByVal bytesTotal As Long)
  ' Data arrived to socket
  Dim a As String, b As String

  If (Not Client.Active) Or (Receiving) Then
    Exit Sub
  End If
  Receiving = True ' Setting 'Received' flag to prevent recursion (it is possible due to DoEvents call inside MessageLoop)
  On Error GoTo ex
  While True
    Client.ReceiveText a, b
    If a <> "" Then
        Memo1.Text = Memo1.Text + a
        GoTo ex
    End If
  Receiving = False
End Sub

Sincerely yours
Eugene Mayevski
Posted: 06/04/2007 13:22:04
by Jeff Lindborg (Basic support level)
Joined: 06/12/2006
Posts: 26

I'll run through and change a few apps to test this - but be aware, this was NOT the way it always was. I can assure you I'm not insane - all the apps (including your old samples) worked fine with your older DLLs and stopped with the newer ones.

Not the end of the world to make this change but this is something that should be noted in your release notes.
Posted: 06/04/2007 13:34:12
by Eugene Mayevski (EldoS Corp.)

I believe that the applications worked, but, as said, this was merely a coincidence. They should not (as the sample should not). When we changed some unrelated things, they stopped working. I am really sorry about the problem, but I don't see where we could change the existing [correct] behaviour.

Sincerely yours
Eugene Mayevski
Posted: 06/04/2007 14:58:05
by Jeff Lindborg (Basic support level)
Joined: 06/12/2006
Posts: 26

The change worked fine in my apps.

Not asking you to change it back, just call it out in your release notes so folks like me don't get burned by such things.
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.



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