I have to download some files from a SFTP location.
I am using the SharpSsh
libraries but I am unable to connect.
Below are my SFTP details :
<add key="FTPHost" value="xyz.csod.com" />
<add key="FTPDirectory" value="/Test" />
<add key="FTPUserName" value="abc" />
<add key="FTPPassword" value="pass" />
<add key="FTPPort" value="22" />
And below is piece of code of c# to connect with SFTP :
using Tamir.SharpSsh;
using Tamir.SharpSsh.jsch;
using Tamir.Streams;
public string DownloadFile()
{
Sftp oSftp = new Sftp(host, userName, password);//
oSftp.Connect(port);
}
But I am getting exception at Connect().Is -
Additional information:
System.Net.Sockets.SocketException (0x80004005): The requested name is valid, but no data of the requested type was found
System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) at System.Net.Dns.GetHostByName(String hostName) at Tamir.SharpSsh.java.net.Socket..ctor(String host, Int32 port) at Tamir.SharpSsh.jsch.Util.createSocket(String host, Int32 port, Int32 timeout)"
I am working with C# console application.
host
variable? Is it thexyz.csod.com
? Or something else. It's not clear from your question. 2) Can you connect to the SFTP server from the same machine using GUI SFTP client? 3) Use another SFTP library. SharpSsh is not maintained for years.