Archived Forum Post

Index of archived forum posts

Question:

SFTP Failed to get address info

Dec 09 '16 at 18:27

I'm able to connect to this SFTP site on the same PC I'm writing this code on using FileZilla using all default settings

Using the host name, I get the below error

ChilkatLog:
  Connect_SFtp(31ms):
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: *********
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    SftpVersion: 0
    Component successfully unlocked using purchased unlock code.
    connectInner(31ms):
      hostname: *****.***.***
      port: 22
      sshConnect(16ms):
        connectSocket(16ms):
          domainOrIpAddress: *****.***.***
          port: 22
          connectTimeoutMs: 5000
          connect_ipv6_or_ipv4(16ms):
            Multi-threaded domain to IP address resolution
            resolveHostname6(16ms):
              getAddressInfo(16ms):
                Failed to get host address info. (3)
                SocketError: Error 0x2afb
                Check to make sure the connection is not blocked by a firewall or anti-virus port filtering.
                hostOrIpAddr: *****.***.***
                port: 22
                Versions of Windows earlier than Windows XP are limited to handling IPv4 only
                On Windows Server 2003 and Windows XP, IPv6 addresses are returned only if IPv6 is installed on the local computer.
              --getAddressInfo
            --resolveHostname6
            Domain to IP address resolution failed.
          --connect_ipv6_or_ipv4
        --connectSocket
        Failed to establish initial TCP/IP connection
      --sshConnect
    --connectInner
    Failed.
  --Connect_SFtp
--ChilkatLog

If I use the IP address, I get a different error

ChilkatLog:
  Connect_SFtp(31ms):
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: 
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    SftpVersion: 0
    Component successfully unlocked using purchased unlock code.
    connectInner(16ms):
      hostname: ***.***.***.***
      port: 22
      sshConnect(16ms):
        connectSocket(16ms):
          domainOrIpAddress: ***.***.***.***
          port: 22
          connectTimeoutMs: 5000
          connect_ipv6_or_ipv4:
            This is an IPV4 numeric address.
            Domain to IP address resolution not needed.
            connecting to IPV4 address...
            ipAddress: ***.***.***.***
            createSocket:
              ai_family: 2
              ai_socktype: 1
              ai_protocol: 0
              SocketError: WSAEINVAL An invalid argument was supplied.
            --createSocket
            Failed to create socket for connecting.
          --connect_ipv6_or_ipv4
        --connectSocket
        Failed to establish initial TCP/IP connection
      --sshConnect
    --connectInner
    Failed.
  --Connect_SFtp
--ChilkatLog

Using FileZilla, I do have to click through a warning box stating that the server's host key is unknown - Is that the error SFTP is running into? If so I need to bypass it - I trust the site

Thoughts?


Accepted Answer

After some discussion with chilkat and research through this link: http://stackoverflow.com/questions/4368877/net-proccess-failing-dns-lookup-with-windows-7

The resolution is this: If using Visual Studio on Windows 7 or better, and your project is on a network drive, 1) You must run Visual Studio as an admin (Right click on icon, then select 'Run as Admin') - even if you are in the administrators groups already. Otherwise Windows is trying to raise a UAC prompt and can't. 2) Move your project to a local Drive


Answer

It has nothing to do with the FileZilla warning box stating that the server's host key is unknown. That's not an issue with Chilkat. For example, if you wished, you could get the host key after connecting, save it to some sort of persistent storage, such as a file or database, and then on subsequent connections you could again get the host key and then check to see if it matches one of your "known" host keys. In other words, that's an application choice/feature -- something that could be implemented by the application if desired.

The 1st LastErrorText indicates a DNS problem. Whatever string was supposedly the domain name, was not resolvable by your system. (Chilkat is not resolving domains to IP addresses directly, it makes system calls to do it.)

I don't have enough information to understand the 2nd LastErrorText. The key bit of information required would be the actual domain name string and IP address, but that information was redacted..