简体   繁体   中英

libssh (C++): Possible to redirect some output from some given `fd` to an `ssh_channel` on remote side?

Using the libssh library, one can communicate with a remote host by opening a channel:

// Assume authentication for sshSession has been completed
ssh_channel channel_to_remote = ssh_channel_new(sshSession);
ssh_channel_open_session(channel_to_remote)

Does this channel happen to have a file descriptor that I can access on the remote side? If I have a file descriptor that is already open on my local side, is it possible to use the channel to notify the remote host about the file descriptor?

I have a ready-made executable that I wish to run on the remote side, and this executable writes output to a specific file descriptor (let us call it fd 3). Is it possible to redirect this output from fd 3 to the channel?

Cheers in advance!

Tutorial for libssh is here .

Use a combination of dup() and ssh_channel_callbacks_struct .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM