wodSSHcom is causing beep sound in Windows 2000 (wodWebServer / wodWebServer.NET)
Hi,
I've been using the wodSSH for over a year with great success. I just updated and noticed that my computer is making a beep in between calls to the send command. I've found that putting short sleep statements between the send commands seems to reduce the bell sounds, but it still happens sometimes (see code below).
Also, to actually receive the output from the command sent via send, I have to send additional line feeds before I get the ouput. Is there another way to get the output that is more reliable?
Here is some vb6 code that I have that will produce the bell sound in Windows 2000 (notice the additional sends of vblf required to actually get the output)
Visual Basic 6 code:
Public Function Command(ByVal sCommand As String) As String
On Error GoTo EH
START:
CheckState
'oSSH is wodSSHCom
sCommand = replace(sCommand, vbCrLf, vbLf)
sCommand = replace(sCommand, vbCr, vbLf)
log SSH COMMAND on & oSSH.HostName & & sCommand & vbCrLf
Dim sReply As String
oSSH.send sCommand & vbLf ' 2>&1 & vbLf
sReply = oSSH.WaitFor(sPrompt, iTimeOut)
'Sleep 150
oSSH.send vbLf
sReply = sReply & oSSH.WaitFor(sPrompt, iTimeOut)
'Sleep 100
oSSH.send vbLf
sReply = sReply & oSSH.WaitFor(sPrompt, iTimeOut)
log sReply
log COMMAND COMPLETE & vbCrLf
Command = GetLog
Exit Function
EH:
Debug.Assert False
Dim iErrCount As Integer
If iErrCount < 1 Then
RestartConnection
iErrCount = iErrCount + 1
Resume START
Else
Err.Raise Err.Number, clsSSH.Command: & Err.Source, Err.Description
End If
End Function
Re: wodSSHcom is causing beep sound in Windows 200
Jon,
it beeps? Nice feature, isn't it :) Makes your code happier , right?
I was just kidding, of course. I should say OMG I am so sorry. We did some tests and we put beep for Execute command in able to trace some debug errors (strange things were happening) and forgot to remove it. Please forgive about this! It is fixed now and will be uploaded to our website within 10 minutes.
As for 'reliable receive' - I think the best way is to act on Received event. Can you use events? If you cannot, then pooling Receive until error is returned seems like the only thing you could do.
Kreso
Re: wodSSHcom is causing beep sound in Windows 200
Awesome! Thanks for the reply!
I'm glad I wasn't hearing things!
[:smile:]
Jon
Re: wodSSHcom is causing beep sound in Windows 200
You already thought Elvis is back, right? :)
Kreso
Re: wodSSHcom is causing beep sound in Windows 200
Is the updated version still going to be called 2.3.0.1?
I'm watching the current version you have posted in the top right corner of the page on http://www.weonlydo.com/index.asp?showform=SSH and it doesn't look like it has updated yet.
Also, Is there a good reason why it is necessary to have to send line feeds a couple of times to get the output of a command?
Thanks again,
Jon
Re: wodSSHcom is causing beep sound in Windows 200
It is updated. Version number will be increased on next major update.
I'm not sure about your line feeds. Reason for this could be that there was data in the buffer before you started sending commands - so result that was returned from WaitFor/Execute was not what you expected - it was from previous commands. So, your new linefeeds cause next commands to be executed and it's result returned. I'm not sure about this. If you can zip your code and send it to techsupport, I am willing to try it out.