Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error instantiating client #21

Closed
ralph-fuechtenkort opened this issue Nov 15, 2019 · 2 comments
Closed

Error instantiating client #21

ralph-fuechtenkort opened this issue Nov 15, 2019 · 2 comments

Comments

@ralph-fuechtenkort
Copy link

Good Morning,
just try to integrate flutter_ssh. pubspec and import works fine but actually trying to connect i always receive the error "unknown_client".
I am using it on a machine with android 7.1 and i also have included the libraries dependency in the build grade file.

Any help solving my "stupid" error" highly appreciated :)

Greets from Manila

Ralph

@ralph-fuechtenkort
Copy link
Author

Sorry just to be sure here the code:
var _sshClient = SSHClient(host: _currentTerminal.fiscalStorageUrl,port:_currentTerminal.fiscalStoragePort,username:_currentTerminal.fiscalStorageUser,passwordOrKey: _currentTerminal.fiscalStoragePassword,);
try{
print('Start sftp connect');
String _result = await _sshClient.connectSFTP();
if (_result == "session_connected"){
await _sshClient.sftpUpload(path:localDir.toString() + "/*.txt",toPath: "/var/local/fiscalStorage",
callback: (progress) {
print(progress); // read upload progress
},
);
await _sshClient.disconnectSFTP();
await localDir.delete();
}
} on PlatformException catch (e){
print('Error: ${e.code}\nError Message: ${e.message}');
}

@shaqian
Copy link
Owner

shaqian commented Nov 28, 2019

Hi @ralph-fuechtenkort

You need client.connect() before client.connectSFTP(). Refer to the example code here:
https://github.com/shaqian/flutter_ssh/blob/master/example/lib/main.dart#L117-L119

      String result = await client.connect();
      if (result == "session_connected") {
        result = await client.connectSFTP();

Thanks,
Qian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants