How to use iOS delegate and callback methods from NMSSH library? -


i'm trying use delegate methods nmssh library in ios not working. let's take example.

customviewcontroller.h

#import <uikit/uikit.h> #import <nmssh/nmssh.h>  @interface customviewcontroller : uiviewcontroller<nmsshsessiondelegate, nmsshchanneldelegate>  - (ibaction)connectbutton:(uibutton *)sender;  @end 

customviewcontroller.m

#import "customviewcontroller.h"  @implementation customviewcontroller  -(void)viewdidload{     [super viewdidload]; }  - (ibaction)connectbutton:(uibutton *)sender {          [self serverconnect:@"10.0.0.1"];  }  -(void)serverconnect:(nsstring *)address{  nmsshsession *session = [nmsshsession connecttohost:address withusername:@"username"];  nmsshchannel *mychannel = [[nmsshchannel alloc]init];      if (session.isconnected) {         [session authenticatebypassword:@"password"];          if (session.isauthorized) {             nslog(@"authentication succeeded");             [session setdelegate:self];         [mychannel setdelegate:self];         }     }          nserror *error = nil;         //session.channel.requestpty = yes; (tried , later ignored)         nsstring *response = [session.channel execute:@"mkdir" error:&error];         nslog(@"response device: %@", response); }  - (void)session:(nmsshsession *)session diddisconnectwitherror:(nserror *)error{     nslog(@"log if session disconnects...delegate method"); }  - (void)channel:(nmsshchannel *)channel didreaderror:(nsstring *)error{     nslog(@"error received...delegate method"); }  - (void)channel:(nmsshchannel *)channel didreadrawdata:(nsdata *)data{     nslog(@"read raw data...delegate method"); } 

connection server, sending single line command , acknowledgement server in console ok.

i have decent idea how pass values 1 view controller using delegate (went through few tutorials practical implementation).

with same knowledge attempting response delegate methods parts of nmssh library it's driving me round , round. i've found http://cocoadocs.org/docsets/nmssh/2.2.1/ pretty nice api of library limited knowledge of ios, i'm bit stuck.

please me.

my search came end nmssh asyncapi (branch) supports multithreading.


Comments