Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding my $DISPLAY programatically.



> > >  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)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/x11-users/email@hidden

This email sent to email@hidden

References: 
 >Finding my $DISPLAY programatically. (From: Robert Tillyard <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: "Mark J. Reed" <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Robert Tillyard <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Jeremy Huddleston <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Bill Janssen <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Jeremy Huddleston <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Bill Janssen <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Jeremy Huddleston <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Bill Janssen <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Jeremy Huddleston <email@hidden>)
 >Re: Finding my $DISPLAY programatically. (From: Bill Janssen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.