tags:

views:

223

answers:

5

How could I forward the X window output from a program under Linux (Debian Lenny)? Any suggestions and / or experience?

The easiest way would be to restart the process with a new DISPLAY enviroment variable, but I don't want to take down the process at all. What I'd like is to change the X output to another machine "on the fly"...

Apparently there are some "X proxies" out there that can do this for me, but I haven't got any experience in this nor can Google give me a quick solution.

[edit]Clarification: I do not want to forward the full desktop (with VNC or similar) neither do I want to just forward one window. I want to forward all the output from a certain process, without restarting the process.[/edit]

+2  A: 

I don't think that on the fly is possible... But you could use VNC to see wats going on on the machine.

Not on the fly, but this tutorial might help: http://www.vanemery.com/Linux/XoverSSH/X-over-SSH2.html

Chris
Yes, VNC and xrdp is useful. But still not what I want to do, since that brings forwar the full desktop. VNC I think can even just forward a certain window to the remote machine. But what if a new window or a dialouge appears? It should have to be bound to the process and that is not the case AFAIK.
Tooony
(Contd. ran out of space) The link above is a part of what I do and what I want to do: 'ssh -X user@machine' is very nice, works through firewalls and VNC since it is only using the already established connection between the machines. But it still doesn't help me to get an exisiting process' output.
Tooony
+2  A: 

Your program has made a socket connection (possibly a unix domain socket, possibly a tcp/ip socket) to an X server. There is no way to redirect that socket connection elsewhere once it is open.

Maybe there is some proxy you can put in the middle between the client and the server (right from the start) which will redirect to a different server, but how will it create whatever X objects that were on the one server on the new server? It would have to be pretty damn smart about what had gone before, and replay every X command that came over the socket to the new server.

Paul Tomblin
Exactly. Hence me asking here. ;-) If it were easy, I'd figured it out already. ;-)
Tooony
Yeah, good luck trying to figure out what to do to set up the same conditions on the new server as the program expects. I'd call it impossible in the general case, but maybe possible in certain circumstances.
Paul Tomblin
Thanks! Currently looking at VNC servers, to see if there's a solution there...
Tooony
+1  A: 
ssh -Y user@server

-Y part tels ssh to tunnel X, so when I start some program from client, it will be shown on my screen. Down sides are that client must have X installed (doable but not practical on Windows) and it works only for programs you start from client, you can't hook up on existing video output.

Considering your edit, that you need to see video output of already started process, this approach obviously fails for you.

Slartibartfast
The -Y argument enables trusted X forwarding, yes. -X enables X forwarding that are subject for security control.Still doesn't help me to get an exisiting process'output though. Hence me asking if someone got any experience with X proxies. :)There's no problem running an X server under Windows.;-)
Tooony
+1  A: 

Since there's no answers given so far, only suggestions to do something else, I thought I'd answer my own question. :-)

The closest I can get to doing what I want is to use x11vnc on Linux (as an X server) and Ultra VNC as a client on Windows. There might be other VNC clients that also support connectiong to a single window, but I found Ultra VNC and stopped looking.

Both x11vnc and Ultra VNC got protocol support for forwarding a single window only. There's a bit of configuration to do, and it will only forward the one window, not any new window created from the same process. Pop-ups and dialouge windows might cause a problem, since they might show up on the non forwarded part of the desktop or just show a part on top of the original window...

That is the least bad solution I have found out so far.

Tooony
+2  A: 

Sounds like a job for xmove. It's in Debian (although unfortunately Lenny seems to be missing it; maybe the sid version will work ?) and Ubuntu.

timday
That sounds spot on what I want! :-) Thanks!Only problem is that trhis "xmove has been unmaintained since 1997". I guess that's why it's not in Lenny...Well worth to try out anyway!
Tooony
The wikipedia page for xmove lists a couple of alternatives might be worth trying.
timday