In reference to this:
"
Hello
How can I know when a program is executed when I do:
libssh2_channel_open_session()
libssh2_channel_request_pty()
libssh2_channel_shell()
libssh2_channel_write(<my command>)
... wait while command is executing ...
libssh2_channel_send_eof()
libssh2_channel_wait_eof()
Thanks for any advice,
Vti"
Should not the sequence be:
connect(sock....)
libssh2_session_init()
...authentication
libssh2_channel_open_session()
libssh2_channel_request_pty()
libssh2_channel_exec(channel,"/bin/date")
Now the command should complete when you get an EOF from the channel:
while {
libssh2_channel_read();
if (libssh2_channel_eof(channel)) {
printf("EOF from remote side\n");
break;
}
}
libssh2_channel_close();
libssh2_channel_wait_closed(channel);
However I did not the output from the date command
***************************************************************
This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient, please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily the views of the Department of Lands. This email message has been swept by MIMEsweeper for the presence of computer viruses.
***************************************************************
Please consider the environment before printing this email.
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-08-05