Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!bloom-beacon!erik.UUCP!randy From: randy@erik.UUCP (Randy Brown) Newsgroups: comp.windows.x Subject: X client as RPC server Message-ID: <9010252039.AA04627@erik.uucp> Date: 25 Oct 90 20:39:09 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 45 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 to forestall the inevitable requests. I am interested to know if anyone has further experience, particularly with a solution based on Xt rather than Xview. ... Randy Brown (uunet!erik!rbrown) from Don Bennett (408)433-3311 Frame Technology > rpcListen(client_data, source, id) > caddr_t client_data; > int *source; > XtInputId *id; > { > svc_getreq(1 << *source); > } > > main() > { > int fd; > > svc_register(transp, ...); > fd = transp->xp_sock; > XtAppAddInput(_XtDefaultAppContext(), fd, XtInputReadMask, rpcListen, 0); > XtMainLoop(); > } from David Brownell (508) 671-0348 > It's worth noting that this posted solution works only for UDP RPCs. > That is, if you use TCP for simpler semantics, more data than the > default of 8 Kbytes, or better error reporting, this doesn't work. > > Also, this uses the obsolete svc_getreq() call, which is limited > to 32 file descriptors. More recent UNIXes have a much higher > limit -- this should use svc_getreqset() instead, which handles > many more file descriptors. > > The issue with TCP is that the RPC library needs to allocate and > deallocate file descriptors dynamically. To handle this within > Xt, the input callback for the tcp-based SVCXPRT must diff the RPC > file descriptors in svc_fdset before and after it calls svc_getreqset(), > invoking XtAppAddInput (or XtAddInput) on new file descriptors and > calling XtRemoveInput() one ones that've disappeared. > > 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!