"The requested name is valid, but the requested type was not found" when connecting to SFTP using SharpSsh

I need to download some files from SFTP location.

I am using SharpSsh libraries, but I cannot 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 the C # code snippet for connecting to 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 get an exception in Connect (). Is -

Additional Information:

System.Net.Sockets.SocketException (0x80004005): the requested name is valid, but the data of the requested type was not found

System.Net.Dns.InternalGetHostByName (String hostName, Boolean includeIPv6) in System.Net.Dns.GetHostByName (String hostName) on Tamir.SharpSsh.java.net.Socket..ctor (host String, Int32 port) on Tamir.SharpSsh .jsch.Util.createSocket (host String, Int32 port, Int32 timeout) "

I am working with a C # console application.

+5
source share
1 answer

You can see that something is wrong with your DNS problem. Since throwing exceptions is associated with the word Win.

See the following link for different types of exceptions and exception values ​​associated with the word windows.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx#WSANO_DATA

I am also trying to ping the domain that you specified and it talks about the request timeout. Therefore, there must be something wrong with the DNS.

If you have an IP address, try with an IP address and you can connect to it.

Also make sure. You have correctly configured SFTP where you are trying to connect.

Also try connecting to the server with some FTP client like filezilla or any other. If you can connect, then there is a problem with the code, otherwise it is something related to the installation of STFP

Hope this helps you.

0
source

All Articles