Quantcast
Channel: Chilkat Forum - latest questions
Viewing all articles
Browse latest Browse all 1061

I got a error 'Argument list too long' with sftp connet

$
0
0

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: 9.5.0.68 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";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        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());
        return;
    }

    //  Set some timeouts, in milliseconds:
    sftp.put_ConnectTimeoutMs(5000);
    sftp.put_IdleTimeoutMs(10000);

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

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

    //  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());
        return;
    }
    else {
        Log.i(TAG, absPath);
    }

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

@Override
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;
}

@Override
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.
    //
    System.loadLibrary("chilkat");

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


Viewing all articles
Browse latest Browse all 1061

Trending Articles