Quantcast
Viewing all articles
Browse latest Browse all 1061

ChannelReceiveUntilMatch and Still get output

With Commands

'   Run the 1st command in the remote shell, which will be to
'   "cd" to a subdirectory.
success = ssh.ChannelSendString(channelNum,"cd workspace" & vbCrLf,"ansi")
If (success <> True) Then
    Console.WriteLine(ssh.LastErrorText)
    Exit Sub
End If

'  Retrieve the output.
success = ssh.ChannelReceiveUntilMatch(channelNum,myPrompt,"ansi",True)
If (success <> True) Then
    Console.WriteLine(ssh.LastErrorText)
    Exit Sub
End If

'   Display what we've received so far.  This clears
'   the internal receive buffer, which is important.
'   After we send the command, we'll be reading until
'   the next command prompt.  If the command prompt
'   is already in the internal receive buffer, it'll think it's
'   already finished...
cmdOutput = ssh.GetReceivedText(channelNum,"ansi")
If (cmdOutput = vbNullString ) Then
    Console.WriteLine(ssh.LastErrorText)
    Exit Sub
End If

Console.WriteLine(cmdOutput)

What my question is what the best way to receive output if the success = ssh.ChannelReceiveUntilMatch(channelNum,myPrompt,"ansi",True) if false still?

I want to do a Putty type solution. and described here http://www.chilkatforum.com/questions/1272/understanding-ssh-automation

I'm not sure in VB.net how to do the "done marker"

thank you for reading Brock


Viewing all articles
Browse latest Browse all 1061

Trending Articles