I try to connect using the hostname: sw.mehome.net, and I get the error: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."

I use this code:

 client.Connect(hostname, port)
    client.Login(username, password)

    ' run the 'uname' command to retrieve OS info 
    Dim systemName As String = client.RunCommand("uname -a")
    ' display the output 
    Console.WriteLine("OS info: {0}", systemName)



    ' create client, connect and log in 
    ' ... 

    ' start the 'df' command to retrieve disk usage info 
    Dim shell As Shell = client.StartCommand("df")

    ' read all response, effectively waiting for the command to end 
    Dim response As String = shell.ReadAll()

    ' display the output 
    Console.WriteLine("Disk usage info:")
    Console.WriteLine(response)

I've declared hostname, password, username and port.. Please help.

asked 19 Jul '10, 11:22

Steffen's gravatar image

Steffen
16
accept rate: 0%


This is a network error and usually means that the target machine is not accessible. Possible causes:

  1. The target machine is offline or not connected to the network at the moment.
  2. No SSH server runs at the target machine.
  3. Access to the specified port was blocked by firewall policy at the target machine.
  4. Access to the specified port was blocked by firewall policy at your local machine.

Are you able to connect to the target machine using any third-party SSH client (such as PuTTY) from the same computer where you tried running your code?

link

answered 19 Jul '10, 16:09

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.2k18
accept rate: 32%

Hi Lukas, I try all possible causes but i get same error how to solve this problem?

link

answered 13 Oct '10, 10:47

lav's gravatar image

lav
16
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×39
×22
×18

Asked: 19 Jul '10, 11:22

Seen: 464 times

Last updated: 30 Mar '11, 18:22