Re: Clear wodSSH Buffers - WeOnlyDo Discussion board

Re: Clear wodSSH Buffers (General questions)

by woddrazen, Friday, April 18, 2008, 15:57 (6064 days ago) @ bmclellan

Hi Barry,


You should remove sleep api from your code. Also you should wait for a prompt and then send command. I don't see from your code that you are waiting for a prompt?

You can done that using WaitFor and Regular expression

$ #>]

means it will accept any of those chars ($, ,#,>) if they appear at the end of the line. This includes 99.9 of most UNIX command prompts (including root account).

You can then send command using execute Method. Here is example

[code]Set ssh1 = New wodSSHCom

ssh1.HostName = hostname
ssh1.Protocol = SSH2
ssh1.Blocking = True
ssh1.Login = login
ssh1.Password = password
ssh1.Connect

ssh1.WaitFor ( regex:[$ #>] $ )
ssh1.DataReady = 0
Debug.Print ssh1.Execute( Command to send + vbLf, regex:[$ #>] $ )
ssh1.Disconnect[/code]
Let us know how it goes.


Drazen


Complete thread: