I am currently trying to make a control panel-like program for my Linux server using Visual Basic and SSH.NET. Right now, I want to make the Linux machine reboot when I press a button.
Here is what I have so far:
Dim connInfo As New Renci.SshNet.PasswordConnectionInfo("IP", "USERNAME", "PASSWORD")
Dim sshClient As New Renci.SshNet.SshClient(connInfo)
Dim cmd As Renci.SshNet.SshCommand
Private Sub MaterialFlatButton1_Click(sender As Object, e As EventArgs) Handles MaterialFlatButton1.Click
Using sshClient
sshClient.Connect()
cmd = sshClient.RunCommand("reboot")
sshClient.Disconnect()
End Using
End Sub
When I press the button, the error I get is:
An unhandled exception of type 'Renci.SshNet.Common.SshConnectionException' occurred in Renci.SshNet.dll
Additional information: An established connection was aborted by the software in your host machine.
Is there anything I would need to change with my code?