Fabian Boulegue February 2016

NMSSH does not connect with SWIFT

I just tried to use NMSSH for the first time but it simply does not connect for me

import UIKit
import NMSSH

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        let session = NMSSHSession(host: "11.111.11.11", andUsername: "vnc")
        if session.connected == true{
            session.authenticateByPassword("1234")
            if session.authorized == true {
                print("works")
            }
        }

    }


}

Answers


Fabian Boulegue February 2016

did forget the session.connect() to start the connection

let session = NMSSHSession(host: "11.111.11.11", andUsername: "inc")
        session.connect()
        if session.connected == true{
            session.authenticateByPassword("1234")
            if session.authorized == true {
                print("works")
            }
        }

Post Status

Asked in February 2016
Viewed 2,898 times
Voted 14
Answered 1 times

Search




Leave an answer