[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: X11-Forwarding
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: Re: X11-Forwarding
- From: Andreas Schneider <asn@xxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 05 May 2022 09:37:02 +0200
- To: libssh@xxxxxxxxxx
- Cc: Klaus Schlitt <klaus.schlitt@xxxxxx>
On Monday, April 18, 2022 11:26:23 AM CEST Klaus Schlitt wrote: > Hi, Hi Klaus, die you see the MR to add an X11 example implementation? https://gitlab.com/libssh/libssh-mirror/-/merge_requests/236 Cheers, Andreas > 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 -- Andreas Schneider asn@xxxxxxxxxxxxxx GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
Archive administrator: postmaster@lists.cynapses.org