0
嗨我想開發一個OSX的SSH應用程序,我一直在尋找NMSSH,這是建立在libssh2。如何處理以下用例:通過NMSSH的數據流
應用程序用戶向服務器發送ping命令。 =>結果 是continious反應
NMSSH的方法是發送一個命令得到迴應,並提出,在一個的NSString,見下文。但是,我怎麼能處理一個案例與平反應的情況下,並繼續。我是否需要爲此功能使用另一個SSH軟件包?
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];