"The requested name is valid, but no data of the requested type was found" when connecting to SFTP with SharpSsh

52,309

Solution 1

You can see that is something wrong with your DNS issue. 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 try to ping that domain which you asked in question and It's saying request timeout. So there must be something wrong with DNS.

If you have IP Address of this then try with IP and See are you able to connect on it.

Also make sure that. You have properly setup SFTP there on the server where you are trying to connect.

Also try to connect to there some server with some FTP client like filezilla or any other. If you are able to connect then there is a problem of code otherwise it is something related setup of STFP

Hope this will help you.

Solution 2

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".

Share:
52,309
Pawan Agrawal
Author by

Pawan Agrawal

Updated on July 09, 2022

Comments

  • Pawan Agrawal
    Pawan Agrawal almost 2 years

    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.

  • Pawan Agrawal
    Pawan Agrawal about 9 years
    hi @Jalpesh, thanks for the answer.The given ftp host is a dummy name not original.But I have tried to ping by original name and its giving response.Also i tried ping with IP address and it's giving response too. But it's not connecting with application
  • Jalpesh Vadgama
    Jalpesh Vadgama about 9 years
    Please make sure that it has SFTP setup on that server. Have you tried to connect with it with filezilla or any other ftp client? If not then try it once
  • Pawan Agrawal
    Pawan Agrawal about 9 years
    ,it's connecting via Filezilla.
  • Jalpesh Vadgama
    Jalpesh Vadgama about 9 years
    Are you using SFTP or ftp in file zilla?
  • Jalpesh Vadgama
    Jalpesh Vadgama about 9 years
    try something like below link-blog.deltacode.be/2012/01/05/…
  • Pawan Agrawal
    Pawan Agrawal about 9 years
    i am using SFTP in filezilla