Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!newstop!jaytee!witzend!db From: db@witzend.East.Sun.COM (David Brownell) Newsgroups: comp.windows.x Subject: Re: X client as RPC server Message-ID: <3055@jaytee.East.Sun.COM> Date: 26 Oct 90 13:17:10 GMT References: <9010252039.AA04627@erik.uucp> Sender: news@East.Sun.COM Reply-To: db@east.sun.com (David Brownell) Organization: Sun Microsystems, Billerica MA Lines: 43 In article <9010252039.AA04627@erik.uucp> randy@erik.UUCP (Randy Brown) writes: > Last June there was a brief exchange on the question of using an X > client as an RPC server. I saved the bit below, which I am reposting ... > from David Brownell (508) 671-0348 > > The upcoming release of XView will do this for you automatically if > > you ask, so that you won't have to scour the innards of the window > > system and notifier documentation to find out how to do this! Or the RPC documentation, for that matter! It's now available, both in the version of XView that's available from MIT and in Open Windows version 2. Call notify_enable_rpc_svc(TRUE) to make the XView notifier do the RPC svc_run() dispatching in addition to all the other dispatching it does. The best way to use this is as follows. The only step specific to the XView toolkit is the details of educating the window system toolkit about the RPC subsystem. The basic trick is to use the X server as the rendezvous, rather than the portmapper on some host. - Create the SVCXPRT handle via svc{udp,tcp}_create() and svc_register() it. - Get the address of socket being used (xprt->xp_sock) using getsockname(). - Stick the host address and port number in some X window property (paying attention to byte order) so the other process will be able to see it. - Educate the window toolkit about the RPC subsystem. - If using TCP, both client and server should ignore SIGPIPE so they don't get nuked when some host or network somewhere goes away. Sometime I'll have to dust off that proposal for a TCP_PORT atom, so people don't need to define their own property types all the time. Also, if you're using the transport independent RPC (SVR4) the details of transport level addressing are different; sockets aren't used. - Dave One of the Million monkeys ... see, here's my keyboard!