Re: VB2005 Express - WeOnlyDo Discussion board

Re: VB2005 Express (General questions)

by Robert, Monday, August 06, 2007, 11:45 (6131 days ago) @ wodDamir

Robert,

I've checked, but we haven't received an e-mail from you.

Basically, the way to use the component in VB2005 Express would be to do the following:

1. Choose Project->Add reference from the menu
2. Select Browse tab, browse to System32 folder and import wodSSH.ocx
3. Initialize the component (this should work):

Basically, the following code should work:
---------------------------------------------------------------------
Dim WithEvents ssh1 As WODSSHLib.wodSSH
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ssh1 = New WODSSHLib.wodSSH
ssh1.Hostname = your_host
ssh1.Login = your_login
ssh1.Password = your_pass
ssh1.Connect()
End Sub

Private Sub ssh1_Received(ByVal ByteCount As Short) Handles ssh1.Received
TextBox1.Text += ssh1.Receive()
End Sub
---------------------------------------------------------------------
Also, this sample only connects to the server, and prints out the received text.

Hope this helped.

Regards,
Damba

Hi Damba,

This was a very good start. But I have a small issue. I changed your code to:
[code]Public Class Form1
Dim WithEvents ssh1 As WODSSHLib.wodSSH
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ssh1 = New WODSSHLib.wodSSH
ssh1.Hostname = 192.168.0.240
ssh1.Login = ssh
ssh1.Password = test
ssh1.Protocol = WODSSHLib.ProtocolsEnum.SSH2
ssh1.Prompt = [ssh@Robert HS] >
ssh1.Blocking = True
ssh1.TerminalType = vt100
ssh1.Connect()
End Sub

Private Sub ssh1_Received(ByVal ByteCount As Short) Handles ssh1.Received
Dim ReceiveText As String
TextBox1.Clear()
TextBox2.Clear()
ReceiveText = ssh1.Receive()
TextBox2.Text += status: & CStr(ssh1.State) & vbCrLf
TextBox2.Text += stringlength: & CStr(ReceiveText.Length) & vbCrLf
TextBox1.Text += ReceiveText
End Sub

Private Sub ssh1_Connected(ByVal ErrorCode As Short, ByVal ErrorText As String) Handles ssh1.Connected
TextBox2.Text += connected & vbCrLf
End Sub

Private Sub ssh1_Prompt_Received() Handles ssh1.PromptReceived
TextBox2.Text += prompt received & vbCrLf
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ErrText As String
ErrText = ssh1.Execute( ip hotspot user print & vbCr)
TextBox2.Text += ErrText & vbCrLf
End Sub
End Class
[/code]

The thing is: if I send the print command via the ssh1.Execute the return value I get is not the complete list. I am not sure what I am doing wrong? Do you have any insights?

Thanks,

Robert


Complete thread: