login about faq

Hi, I'm trying the sftp feature with android, but i encountered a error like below when i tried to connect to my own ssh server.

Error: ---------------------------------------------- 07-27 17:24:16.437 3341-3341/com.tabnage.digitalsignage.filesync I/Chilkat: ChilkatLog: Connect_SFtp: DllDate: May 28 2017 ChilkatVersion: UnlockPrefix: Anything for 30-day trial Architecture: Little Endian; 32-bit Language: Android Java VerboseLogging: 0 SftpVersion: 0 connectInner: sshConnect: connectSocket: connect_ipv6_or_ipv4: getAddressInfo: Failed to get host address info. (4) errno: 7 osErrorMessage: Argument list too long hostOrIpAddr: sub.hostname.com port: 10022 Retrying DNS lookup... Failed to get host address info. (4) errno: 7 osErrorMessage: Argument list too long hostOrIpAddr: sub.hostname.com port: 10022 --getAddressInfo getAddressInfo failed. --connect_ipv6_or_ipv4 --connectSocket Failed to establish initial TCP/IP connection --sshConnect --connectInner Failed. --Connect_SFtp --ChilkatLog

and source code is below:

package com.tabnage.digitalsignage.filesync;

import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.view.Menu; import android.view.MenuItem; import com.chilkatsoft.*;

public class MainActivity extends AppCompatActivity {

private static final String TAG = "Chilkat";

protected void onCreate(Bundle savedInstanceState) {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();

    CkSFtp sftp = new CkSFtp();

    //  Any string automatically begins a fully-functional 30-day trial.
    boolean success = sftp.UnlockComponent("Anything for 30-day trial");
    if (success != true) {
        Log.i(TAG, sftp.lastErrorText());

    //  Set some timeouts, in milliseconds:

    int port;
    String hostname;
    hostname = "sub.hostname.com";
    port = 10022;
    success = sftp.Connect(hostname,port);
    if (success != true) {
        Log.i(TAG, sftp.lastErrorText());
    success = sftp.AuthenticatePw("username","password");
    if (success != true) {
        Log.i(TAG, sftp.lastErrorText());

    success = sftp.InitializeSftp();
    if (success != true) {
        Log.i(TAG, sftp.lastErrorText());

    //  To find the full path of our user account's home directory,
    //  call RealPath like this:
    String absPath;
    absPath = sftp.realPath(".","");
    if (sftp.get_LastMethodSuccess() != true) {
        Log.i(TAG, sftp.lastErrorText());
    else {
        Log.i(TAG, absPath);

    Log.i(TAG, "Success.");

public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;

public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;

    return super.onOptionsItemSelected(item);
static {
    // Important: Make sure the name passed to loadLibrary matches the shared library
    // found in your project's libs/armeabi directory.
    //  for "libchilkat.so", pass "chilkat" to loadLibrary
    //  for "libchilkatemail.so", pass "chilkatemail" to loadLibrary
    //  etc.

    // Note: If the incorrect library name is passed to System.loadLibrary,
    // then you will see the following error message at application startup:
    //"The application <your-application-name> has stopped unexpectedly. Please try again."


I hope you give me nice solutions. thanks regard.

asked Jul 27 '17 at 04:33

shin's gravatar image


Did you really pass "sub.hostname.com" to sftp.Connect, or did you substitute "sub.hostname.com" for the actual hostname you passed. To understand the cause of the problem, I'd need to see the exact string you passed to sftp.Connect. (I'd have to reproduce the problem to find the source of the problem.)


answered Aug 09 '17 at 11:59

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jul 27 '17 at 04:33

Seen: 800 times

Last updated: Aug 09 '17 at 11:59

powered by OSQA