login about faq

I am attempting to upgrade from ChilkatDotNet4.dll version 9.4.1.0 to 9.5.0.58 but the following code no longer works:

sshCK.SendReqExec(channelNum, "type \remote_host_Bshare_name$data.csv && echo Get_Complete"); sshCK.ChannelReceiveUntilMatch(channelNum, "Get_Complete", "ansi", false);

I am connecting to Windows host A via SSH and then having host A print the contents of a remote file on host B, and then append the keyword "Get_Complete" so I know where the data ends.

Here are my observations:

1) This works fine with 9.4.1.0 (i.e. ChannelReceiveUntilMatch() returns true) 2) If I ignore the error and call GetReceivedText(), the data that is returned is exactly what I expected to receive. 3) I tried playing around with ReadTimeoutMs, but regardless of its value the command always returns in about 25ms.

Has this command changed significantly since 9.4 and I just need to change my logic? Or is there a bug of some kind?

Thanks, Richard

Chilkat error: ChilkatLog:
  ChannelReceiveUntilMatch(16ms):
    DllDate: Jun 13 2016
    ChilkatVersion: 9.5.0.58
    UnlockPrefix: PETERLSSH
    Architecture: Little Endian; 64-bit
    Language: .NET 4.0 / x64
    VerboseLogging: 1
    channelReceiveUntilMatch(16ms):
      channel: 5
      pattern: Get_Complete
      charset: ansi
      caseSensitive: 0
      readChannelData(16ms):
        mType: IGNORE
        mType: CHANNEL_DATA
        dataLen: 80
        clientWinSize: 327600
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 512
        clientWinSize: 327088
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 1024
        clientWinSize: 326064
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 1968
        clientWinSize: 324096
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 512
        clientWinSize: 323584
      --readChannelData
      readChannelData:
        mType: IGNORE
        mType: CHANNEL_DATA
        dataLen: 80
        clientWinSize: 323504
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 944
        clientWinSize: 322560
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 512
        clientWinSize: 322048
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 400
        clientWinSize: 321648
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 512
        clientWinSize: 321136
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 784
        clientWinSize: 320352
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 80
        clientWinSize: 320272
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 784
        clientWinSize: 319488
      --readChannelData
      readChannelData:
        mType: IGNORE
        mType: CHANNEL_DATA
        dataLen: 80
        clientWinSize: 319408
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 1696
        clientWinSize: 317712
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 784
        clientWinSize: 316928
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 1344
        clientWinSize: 315584
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 704
        clientWinSize: 314880
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 912
        clientWinSize: 313968
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 1104
        clientWinSize: 312864
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 2746
        clientWinSize: 310118
      --readChannelData
      readChannelData:
        mType: CHANNEL_DATA
        dataLen: 14
        clientWinSize: 310104
      --readChannelData
      readChannelData:
        mType: IGNORE
        mType: CHANNEL_REQUEST
        Received CHANNEL REQUEST message
        requestType: exit-status
        wantReply: 0
        exitStatusCode: 0
        Received channel request 
      --readChannelData
      readChannelData:
        mType: CHANNEL_EOF
      --readChannelData
      readChannelData:
        mType: CHANNEL_CLOSE
        Sent SSH Channel CLOSE
      --readChannelData
      Failed to receive until match.
    --channelReceiveUntilMatch
    Failed.
  --ChannelReceiveUntilMatch
--ChilkatLog

asked Jul 19 at 15:11

rkroehl's gravatar image

rkroehl
1

edited Jul 19 at 15:22

jpbro's gravatar image

jpbro ♦
1.1k2618


This was a recent problem fixed just after the v9.5.0.58 release. Here's the new build w/ the patch:

32-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet4-9.5.0-win32.zip
64-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet4-9.5.0-x64.zip

link

answered Jul 19 at 15:57

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Hi,

The following code has worked perfectly using ChilkatDotNet4-9.5.0.40

Yesterday I upgraded to ChilkatDotNet4-9.5.0.58 and found that _ChilkatSSH.ChannelReceiveUntilMatch fails to find the match string "AReady" (90 second timeout expired). If I skip over the error and look at the subsequent _ChilkatSSH.GetReceivedText, everything received is normal including the match string "AReady".

Seeing the above topic (a related bug?) and your replied patch, ChilkatDotNet4-9.5.0.59, I immediately downloaded and tried it.

Unfortunately, for me, .59 failed exactly as .58

Again, .40 works perfectly. .58 & .59 do not.

Please advise.

Thank you very much!

Regards, Peter

   For i = 0 To MAX_CONNECTION_RETRIES
                If _ChilkatSSH.Connect(pAApp_IPAddress, "22") Then Exit For
                Threading.Thread.Sleep(4000)
            Next
            If (_ChilkatSSH.AuthenticatePw(pAApp_AMMI_I_Username, pAApp_AMMI_I_Password) <> True) Then Throw New System.Exception(_ChilkatSSH.LastErrorText & vbCrLf)
            _Channel = _ChilkatSSH.OpenSessionChannel() 'Open a session channel.  (It is possible to have multiple session channels open simultaneously.)
            If (_Channel < 0) Then
                Throw New System.Exception(_ChilkatSSH.LastErrorText & vbCrLf)
            End If
            ' Create a dumb terminal with a call to Putty???
            If (_ChilkatSSH.SendReqPty(_Channel, termType, widthInChars, heightInChars, pixWidth, pixHeight) <> True) Then Throw New System.Exception(_ChilkatSSH.LastErrorText & vbCrLf)
            '  Start a shell on the channel:
            If (_ChilkatSSH.SendReqShell(_Channel) <> True) Then Throw New System.Exception(_ChilkatSSH.LastErrorText & vbCrLf)
            If (_ChilkatSSH.ChannelReceiveUntilMatch(_Channel, "AReady", "ansi", True) <> True) Then Throw New System.Exception(_ChilkatSSH.LastErrorText & vbCrLf)
            pAApp_AMMI_I_Output = _ChilkatSSH.GetReceivedText(_Channel, "ansi")
            _Details &= "SendReqShell:" & pAApp_AMMI_I_Output
            If (pAApp_AMMI_I_Output = vbNullString) Then
                Throw New System.Exception(_ChilkatSSH.LastErrorText & vbCrLf)
            End If
link

answered Aug 11 at 12:05

peterw's gravatar image

peterw
1

Have you tried "AReady" as the second argument to ChannelReceiveUntilMatch()? I'm not sure when the need to put wrap your keyword in asterisks came about but it worked for me with the .59 release.

(Aug 11 at 12:20) rkroehl

the asterisks got removed from my previous comment. So it would be quote asterisk AReady asterisk quote

(Aug 11 at 12:21) rkroehl
link

answered Aug 11 at 13:14

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Thank you, rkroehl and Chilkat.

Patch ChilkatDotNet4-9.5.0.59 is working. Based on rkroehl's suggestion, surrounding the match string with asterisks works. I then modified all of my existing source appropriately.

Thank you again for your help!

Regards, Peter

link

answered Sep 01 at 12:25

peterw's gravatar image

peterw
1

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×90

Asked: Jul 19 at 15:11

Seen: 280 times

Last updated: Sep 01 at 12:25

powered by OSQA