Path: utzoo!attcan!uunet!decwrl!ucbvax!bloom-beacon!convex.UUCP!root From: root@convex.UUCP (Superuser) Newsgroups: comp.windows.x Subject: Lost mail for you Message-ID: <9006071737.AA16405@sushi> Date: 7 Jun 90 17:37:21 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 69 From pescadero.stanford.edu!expo.lcs.mit.edu!xpert-mailer Sat Jun 2 14:43:51 1990 remote from convex Received: by sushi (5.51/7.0) id AA03553; Sat, 2 Jun 90 14:43:51 CDT Received: by convex.COM (5.51/4.7) id AA27946; Sat, 2 Jun 90 14:43:11 CDT Received: from Erebus.Stanford.EDU by uxc.cso.uiuc.edu with SMTP (5.62+/IDA-1.2.8-900601) id AA03581 (for salevin%drlc1.UUCP@convex.com); Sat, 2 Jun 90 14:38:49 -0500 Received: from Hanauma.Stanford.EDU by erebus.Stanford.EDU with TCP; Sat, 2 Jun 90 12:39:08 PDT Received: by hanauma.stanford.edu (5.51/7.0) id AA14837; Sat, 2 Jun 90 12:38:36 PDT Received: from EXPO.LCS.MIT.EDU by Pescadero.Stanford.EDU (5.59/25-eef) id AA27650; Sat, 2 Jun 90 12:37:35 PDT Received: by expo.lcs.mit.edu; Sat, 2 Jun 90 11:30:57 EDT Received: from bloom-beacon.MIT.EDU by expo.lcs.mit.edu; Sat, 2 Jun 90 11:30:46 EDT Received: by bloom-beacon.MIT.EDU (5.61/25-eef) id AA10322; Sat, 2 Jun 90 11:13:58 EDT Received: from USENET by bloom-beacon.mit.edu with netnews for xpert@expo.lcs.mit.edu (xpert@expo.lcs.mit.edu) (contact usenet@bloom-beacon.mit.edu if you have questions) Date: 2 Jun 90 15:06:35 GMT From: convex!lll-winken.llnl.gov!db%witzend%east%newstop%sun-barr (David Brownell) Organization: Sun Microsystems, Billerica MA Subject: Re: Need Help with mixing RPC and X Message-Id: <1984@east.East.Sun.COM> References: <9005312234.AA18852@viking.frame.com> Sender: convex!expo.lcs.mit.edu!xpert-request To: xpert@expo.lcs.mit.edu Re the question of how to get an X (Xt) application to act as an RPC server (client is no issue), dpb@viking.frame.com (Don Bettnet) writes: >> 1. The ability to tell XtMainLoop to look for an RPC request while >> looking for X events, and have it call an appropriate callback. >> > >How about this? Works for me.... > Solution deleted to avoid clutter: it used XtAppAddInput() > to install an input callback on the file descriptor used by > the service transprot handles: SVCXPRT *t; fd = t->xp_sock. > The input callback invoked svc_getreq() to handle the call. 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! David Brownell db@east.sun.com. Sun Desktop Systems Software (508) 671-0348 "We'll get to ISO, Mars, and Pluto ... not necessarily in that order."