[comp.windows.news] multiple-server clients

simon@macondo.SW.MCC.COM (Simon John Gibbs) (07/01/88)

I have been writing NeWS applications where clients
need to connect to more than one NeWS server. The problem
is that the cps interface seems to be written under the assumption
that a client is only dealing with one server (the one
running on the host in the NEWSSERVER environment variable).

Why build a server based window system and then build in restrictions
that make it difficult for clients to connect?

What I ended up doing is modifying cps and libcps
so that the client now does:

	cid = ps_open_PostScript(host)
	ps_close_PostScript(cid)
	ps_flush_PostScript(cid)

where host is a string and cid a small integer (ps_open_PostScript
could easily be extended to include a port if one had multiple
servers per machine).

The cps files are the same, but if there's something like

	cdef ps_fun(x, y, z)

The call from the C client looks like:

	ps_fun(cid, x, y, z)

Now my problem is I have a non-standard cps and libcps.

What I was wondering is whether there's a better way to do this,
or, if not, if anyone knows whats happening with cps etc.
in the next release of NeWS (the NeWS/X11 merge?) ??

Regards - Simon Gibbs   (simon@mcc.com)

janssen@titan.SW.MCC.COM (Bill Janssen) (07/05/88)

Xlib handles multiple servers with the notion of a `default server'.
All C calls on Xlib are directed toward that server.  The call to
connect to a server returns a handle to that server, and makes it the
default:

	display = XOpenDisplay (server_name);

The default display can be changed:

	XSetDisplay (display);

This works pretty well if the granularity of your interaction with the
server is modestly large, as it tends to be with X.  If you need an
interface that tends to send every command to every server, you may want
instead to implement a `grouped default server', which is really a list
of servers.  Every command would be repeated on each server in the list.
This could be implemented in the library so that all calls look alike,
and the functions are somewhat polymorphic, specializing on the server-type,
normal or grouped.

Warmest regards, Bill

chan@hpfcmr.HP.COM (Chan Benson) (07/05/88)

> Xlib handles multiple servers with the notion of a `default server'.
> All C calls on Xlib are directed toward that server.  The call to
> connect to a server returns a handle to that server, and makes it the
> default:
> 
> 	display = XOpenDisplay (server_name);
> 
> The default display can be changed:
> 
> 	XSetDisplay (display);
 
Note that this describes the way things are done in X10. In X11, Xlib 
calls almost universally take a display argument that indicates which
server to direct the request to.

			-- Chan

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (07/08/88)

    Date: Wed, 6 Jul 88 00:03:27 EDT
    From: cs.utexas.edu!milano!titan!janssen@rutgers.edu  (Bill Janssen)

    Xlib handles multiple servers with the notion of a `default server'.
    All C calls on Xlib are directed toward that server.

Somebody is speaking ancient tongues here.  That was true of X10,
but is not true of X11.