[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
X11-Forwarding
[Thread Prev] | [Thread Next]
- Subject: X11-Forwarding
- From: Klaus Schlitt <klaus.schlitt@xxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 18 Apr 2022 11:26:23 +0200
- To: libssh@xxxxxxxxxx
Hi, I want to forward the X11 output from the remote application (e.g. xterm) to my local computer. From the libssh tutorial, I have used this code fragment to do so: ssh_channel x11channel; rc = ssh_channel_request_pty(channel); if (rc != SSH_OK) return rc; rc = ssh_channel_change_pty_size(channel, 80, 24); if (rc != SSH_OK) return rc; int displayNr = 100; rc = ssh_channel_request_x11(channel, 0, NULL, NULL, displayNr); if (rc != SSH_OK) return rc; rc = ssh_channel_request_shell(channel); if (rc != SSH_OK) return rc; x11channel = ssh_channel_accept_x11(channel, 3000); if (x11channel == NULL) return -1; My callback function, which is called at the time, ssh_channel_accept_x11() is executed, looks like: static ssh_channel my_channel_open_request_x11_callback(ssh_session session, const char* originator_address, int originator_port, void* userdata) { ssh_channel channel = ssh_channel_new(session); return channel; } My expectation was, that the ssh_channel, provided by ssh_channel_accept_x11(), must be used then to do the ssh request from where the X11 output will be redirected to my local computer. Problem: After the specified timeout (3000 ms in my example), the function ssh_channel_accept_x11() returns NULL, although the return value of the callback function was not NULL. From the console log "channel" shows the newly created ssh channel from the callback function: [2022/04/18 10:33:34.651892, 2] grow_window: growing window (channel 43:0) to 1280000 bytes session = 0x16C9138 originator_address = ::1 originator_port = 40528 userdata = 016D9ED8 channel = 0x16D9E60 [2022/04/18 10:33:40.551005, 2] grow_window: growing window (channel 44:3) to 1280000 bytes [2022/04/18 10:33:43.951259, 1] ssh_channel_accept: No channel request of this type from server [2022/04/18 10:38:10.603076, 1] channel_request: Channel request exec failed The problem seems to be: "No channel request of this type from server" What is wrong with my implementation? The complete example can be found here: http://kschlitt.bplaced.net/LibsshTestX11.cpp My goal is to open the X11 window on my local computer where cygwin-x is installed. rc = ssh_channel_request_exec(channel, "xterm -display localhost:100.0"); Is my approach correct for this goal? If I use the same display number, which other cygwin xterm windows have already set, then the X11 windows is opened on my local computer by executing the command ("xterm"). Problem with this solution: How to know the display number to use for this purpose? Thanks, Klaus
Archive administrator: postmaster@lists.cynapses.org