Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: How to detect X?

by Anonymous Monk
on Feb 21, 2005 at 12:09 UTC ( [id://433110]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: How to detect X?
in thread How to detect X?

Once you have the hostname and the display number, add 6000 to the display number and attempt to make a TCP connection to that port number. If the connection fails, X is not running.
If you have setup X-Windows insecurely (that is, let anyone connect to it - you didn't think that "xhost" is much of a security, do you?), you are right. Sane people start their X-Windows server in such a way it isn't listening to port 6000. Or any other port for that matter.

X-Windows works fine using Unix domain sockets as well. You just can't display an alien application from elsewhere. Which is a good thing. (Though I have no idea whether X-Windows servers on Windows (sic!) machines can do this).

Replies are listed 'Best First'.
Re^3: How to detect X?
by meredith (Friar) on Feb 22, 2005 at 15:07 UTC

    To further the argument against leaving X listening to a tcp port, I should point out that using a domain socket doesn't exclude the use of remote X apps. It's fairly easy to get them tunneled through ssh connections back to your display. ssh is smart enough to use xauth cookies for you, too.

    mhoward - at - hattmoward.org

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://433110]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.