Re: Clear wodSSH Buffers - WeOnlyDo Discussion board

Re: Clear wodSSH Buffers (General questions)

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

Hello,

I tried setting DataReady property to 0, but it didn't seem to work.

[code]
objSSH.HostName = IP
objSSH.Login = UserName
objSSH.Password = Password
objSSH.Blocking = 1
objSSH.Protocol = Protocol ;= 1 or 4
objSSH.Port = Port
objSSH.Timeout = 180
t1 = objSSH.Connect

objSSH.Send( Command to send )


TimeDelay(3) ;Give time for the command to start allowing us to retrieve data

if timeout < 300 then timeout = timeout + 120 ;if the timeout if way to low, set it to a lower value
objSSH.Timeout = timeout ; + 120 ;length of the timeout + 120 seconds

while (timediffsecs(timeymdhms(),TimeStart) < timeout) ; start a loop - loop will end if : get hung up on(loose carrier), or
if objSSH.DataReady then
t1 = objSSH.Receive(objSSH.DataReady)

;Logic to look in T1 to see if the command is complete
; or if there was an error
; I can't block until timeout, I must continually poll the data at each iteration
; and see if a condition exists within the data returned

returndata = StrCat(returndata,t1)

if objSSH.DataReady<1 then ;no data is ready anymore so break out of loop
timedelay(3) ;give it 3 seconds to make sure nothing more to come
if objSSH.DataReady<1 then
break
end if
end if
end if
end while

objSSH.Timeout = 0 ;set it to not timeout for our parsing routines later
Return returndata

:WBErrorHandler
ErrCode = LastError()
ErrText = IntControl(34, ErrCode, 0 , 0, 0)
Return returndata

[/code]


Complete thread: