Reputation: 283
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.
Upvotes: 17
Views: 86114
Reputation: 14266
You can see that is something wrong with your DNS. As exception throwing is a related with Win socket.
See following link for different kind of exceptions and meaning of exception related to windows socket.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx#WSANO_DATA
Also I tried to ping that domain which you asked about in the question, and it's saying request timeout. So there must be something wrong with DNS.
If you have the IP address for this, then try with the IP and see if you are able to connect to it.
Also make sure that you have properly set up SFTP on the server where you are trying to connect.
Also try to connect to some server with some FTP client like filezilla or any other. If you are able to connect then there is a problem with the code, otherwise it is something related to the setup of STFP.
I hope this will help you.
Upvotes: 9
Reputation: 21
I had this error recently, it was resolved with a follow-up note from our server personnel "a reverse lookup zone for that IP address subnet was added/made available".
Upvotes: 1