<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>Remote X Apps mini-HOWTO: Telling the Client</TITLE> <LINK HREF="Remote-X-Apps-6.html" REL=next> <LINK HREF="Remote-X-Apps-4.html" REL=previous> <LINK HREF="Remote-X-Apps.html#toc5" REL=contents> </HEAD> <BODY> <A HREF="Remote-X-Apps-6.html">Next</A> <A HREF="Remote-X-Apps-4.html">Previous</A> <A HREF="Remote-X-Apps.html#toc5">Contents</A> <HR> <H2><A NAME="s5">5. Telling the Client</A></H2> <P>The client program (for instance, your graphics application) knows which display to connect to by inspecting the <CODE>DISPLAY</CODE> environment variable. This setting can be overridden, though, by giving the client the command line argument <CODE>-display hostname:0</CODE> when it's started. Some examples may clarify things. <P>Our computer is known to the outside as light, and we're in domain uni.verse. If we're running a normal X server, the display is known as <CODE>light.uni.verse:0</CODE>. We want to run the drawing program xfig on a remote computer, called <CODE>dark.matt.er</CODE>, and display its output here on light. <P>Suppose you have already telnetted into the remote computer, <CODE>dark.matt.er</CODE>. <P>If you have csh running on the remote computer: <P> <BLOCKQUOTE><CODE> <PRE> dark% setenv DISPLAY light.uni.verse:0 dark% xfig & </PRE> </CODE></BLOCKQUOTE> <P>or alternatively: <P> <BLOCKQUOTE><CODE> <PRE> dark% xfig -display light.uni.verse:0 & </PRE> </CODE></BLOCKQUOTE> <P>If you have sh running on the remote computer: <P> <BLOCKQUOTE><CODE> <PRE> dark$ DISPLAY=light.uni.verse:0 dark$ export DISPLAY dark$ xfig & </PRE> </CODE></BLOCKQUOTE> <P>or, alternatively: <P> <BLOCKQUOTE><CODE> <PRE> dark$ DISPLAY=light.uni.verse:0 xfig & </PRE> </CODE></BLOCKQUOTE> <P>or, of course, also: <P> <BLOCKQUOTE><CODE> <PRE> dark$ xfig -display light.uni.verse:0 & </PRE> </CODE></BLOCKQUOTE> <P>It seems that some versions of telnet automatically transport the <CODE>DISPLAY</CODE> variable to the remote host. If you have one of those, you're lucky, and you don't have to set it by hand. If not, most versions of telnet do transport the <CODE>TERM</CODE> environment variable; with some judicious hacking it is possible to piggyback the <CODE>DISPLAY</CODE> variable on to the <CODE>TERM</CODE> variable. <P>The idea with piggybacking is that you do some scripting to achieve the following: before telnetting, attach the value of <CODE>DISPLAY</CODE> to <CODE>TERM</CODE>. Then telnet out. At the remote end, in the applicable <CODE>.*shrc</CODE> file, read the value of <CODE>DISPLAY</CODE> from <CODE>TERM</CODE>. <P> <HR> <A HREF="Remote-X-Apps-6.html">Next</A> <A HREF="Remote-X-Apps-4.html">Previous</A> <A HREF="Remote-X-Apps.html#toc5">Contents</A> </BODY> </HTML>