0

Hi I want to develop an SSH application for OSX and i have been looking into NMSSH, which is built on libssh2. How can I handle the following use case:

The application user sends a ping command to the server. => the result is continious responses

NMSSH's approach is send a command get a response and put that in a NSString, see below. But how can i handle a case with for instance ping where the response goes on and on. Do I need to use another SSH package for this functionality?

NMSSHSession *session = [NMSSHSession connectToHost:@"127.0.0.1:22"
                                       withUsername:@"user"];

if (session.isConnected) {
    [session authenticateByPassword:@"pass"];

    if (session.isAuthorized) {
        NSLog(@"Authentication succeeded");
    }
}

NSError *error = nil;
NSString *response = [session.channel execute:@"ls -l /var/www/" error:&error];
NSLog(@"List of my sites: %@", response);

BOOL success = [session.channel uploadFile:@"~/index.html" to:@"/var/www/9muses.se/"];

[session disconnect];
4

1 回答 1

2

正确的答案是结合通道委托的回调方法使用库的外壳功能。在 lib 中发现了一些问题,但在问题 #20中已修复

于 2013-07-01T09:49:11.730 回答