[comp.windows.x] Hostname property

bilbo.geoff@SEAS.UCLA.EDU (Geoff Kuenning) (02/10/88)

It would occasionally be useful (at least for us) for an X client to be
able to find out whether it is running on a server local to its own machine,
as opposed to across the net.  One way to discover this is to examine the
Internet address of the connection socket;  but this is fairly non-portable,
and we'd have to write separate code for each of Decnet, TCP/IP, and local
(AF_UNIX) sockets.

A second way would be to examine the display-selection string passed to
XOpenDisplay.  A string of "unix:*" would be taken as local, while a string
of "<hostname>:*" could be compared with the local hostname (from "hostname"
or "uname") to discover if they match.

However, both of these methods strike us as moderately ugly.  What we came
up with as a third alternate is to have the server provide a built-in
property atom that gave the hostname.  Then a client could query this atom,
and compare it with the hostname or uname return value.  That way, the
code that checked the hostname wouldn't be dependent on knowing what had
been passed to XOpenDisplay.

(As long as we're going to do this, it probably would be a good idea to
have a second property that gave the display unit number, just for
completeness.)

What do people think of this idea?  And, if you agree, what are good names
for the properties?  I was thinking "hostname" and "display_unit", capitalized
to match existing properties (I haven't looked).

	Geoff Kuenning	geoff@lcc.ucla.edu	geoff@ITcorp.com