Article 171383 of comp.os.vms: In article <5n6nv1$oit@gap.cco.caltech.edu>, mathog@seqaxp.bio.caltech.edu writes: >Wolfgang J. Moeller informs me that there is a magical function present in >OpenVMS Xlib for handling the "can't use select() because we have even >flags and not file descriptors" problem. It is: I feel like I'm missong something here; what's wrong with XtAppAddInput ? OK, for VMS you have to deal with event flags rather than fd's, but it's quite easy to have for example, a Motif /sockets application that compiles for Unix or VMS with minimal system dependent code, as the following extracts show. /* VMS helpers */ #ifdef __VMS #define EVENT_FLAG 1 void vmsast (void *s) { sys$setef (EVENT_FLAG); } void vmsioinit (appdata_t * sr) /* sr holds lots of instance specific stuff */ { sys$clref (EVENT_FLAG); sys$qiow (0, sr->chan, IO$_SETMODE | IO$M_READATTN, NULL, 0, 0, vmsast, sr, 0, 0, 0, 0); } #endif /* The socket is created normally socket(), connect() etc. */ /* here is the XtAppAddInput call back */ static void ipfunc (XtPointer clientdata, int *pfd, XtInputId * xid) { appdata_t *sr = (appdata_t *) clientdata; char *p; int n, nb; nb = sizeof (sr->buf) - 1; n = recv (sr->sock, p, nb, 0); if (n > 0) { ..... /* process the read */ #ifdef __VMS vmsioinit (sr); /* reset the ast */ #endif } else { sr->error = errno; XtRemoveInput (*xid); shutdown (sr->sock, 2); close (sr->sock); sr->sock = -1; } } /* Start the socket bit */ static void StartIpStuff (appdata_t * sr) { sr->error = 0; if (getsock (sr) > 0) /* does socket() and connect etc */ { if(sr->tid) { XtRemoveTimeOut(sr->tid); sr->tid = 0; } #ifdef __VMS sr->chan = decc$get_sdc (sr->sock); XtAppAddInput (sr->app, EVENT_FLAG, NULL, ipfunc, (XtPointer) sr); vmsioinit (sr); #else XtAppAddInput (sr->app, sr->sock, (XtPointer) XtInputReadMask, ipfunc, (XtPointer) sr); #endif send (sr->sock, LOGIN, LOGIN_SIZE, 0); /* who's there */ } .... } Hope this helps. -- ----------------------------------------------------------------------- Jonathan R Hudson Email: jrh@jrhudson.demon.co.uk WWW: http://www.jrhudson.demon.co.uk Voice/Fax: +44 (0)1703 867843