Re: Finding my $DISPLAY programatically.
Re: Finding my $DISPLAY programatically.
- Subject: Re: Finding my $DISPLAY programatically.
- From: Bill Janssen <email@hidden>
- Date: Sat, 3 May 2008 16:14:24 PDT
- Comments: In-reply-to Bill Janssen <email@hidden> message dated "Sat, 03 May 2008 15:30:53 -0700."
> > > So when the server is running on port
> > > 6001 (display :1), you need to send that info over to the remote
> > > machine as MYIP:1.
> >
> > Right, the other machine needs to do MYIP:1. Stuff on the local
> > machine can use either localhost:1, MYIP:1, unix:1, :1, or /tmp/
> > launchd-XXXXX/:0 as $DISPLAY
>
> Oh, man, you're kidding me, right? If the server comes up as display
> "1" (localhost:1), it's still /tmp/launchd-XXXXX/:0? So if the value
> of the environment variable DISPLAY evaluates to
> /tmp/launchd-XXXXX/:0, there's no way to tell from that which
> externally addressable IP port the server is listening on?
I've verified this; it's always /tmp/launchd-XXXX/:0, even if the
actual display you're connecting to is :1. No wonder Rob's having
trouble.
But I guess it might still be possible. We know it's a TCP port in
the low 6000's, and we know the X11 server is being run under the
account of the user. Here's my script now:
#!/bin/sh
MYPORT=`lsof -i tcp:6000-6020 | grep "${USER}.*IPv4.*(LISTEN)" | awk '{print substr($9, 3) - 6000}'`
MYIP=`ifconfig -a | grep 'inet.*broadcast' | awk '{print $2}'`
echo ${MYIP}:${MYPORT}
This should echo the externally addressable DISPLAY setting for your
display, assuming you've got your Mac X11 set up to be connectable
from outside.
Bill
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden