int main () { try { Connection connection("hostname", 22, true); // connection.setCredentials("", ""); // connection.setKeyPath(""); UserInfo ui = connection.getUserInfo(); cout << "User infos:\n" << " login: "******" home: " << ui.getHomeDir() << endl << " shell: " << ui.getUserShell() << endl; connection.mkConnection(); if (connection.isSessionValid()) cout << "Connection OK" << endl; connection >> "whoami" >> "id" >> "echo 'test' > msg" >> "cat msg"; string received_out = connection.getLastOutput(); cout << "Received output: " << endl << received_out << endl; } catch (Exception & e) { cout << "Exception caught: " << e.what() << endl; } return 0; }