[comp.windows.x] IPC problem

cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) (11/16/90)

> I have an application which needs to read data off a socket.  I can 
> arrange for it to be sent a ClientMessage when this data is to be
> transmitted, but since the amount of data could be fairly large (though
> I'm working to keep it of moderate size), I'd rather not have the
> application simply sit there (vis a vis X) while reading data.  I'd
> like to be able for it to respond to Expose events and the like while
> still receiving data.  Is there a reasonable way to do this?  I'm using
> just Xlib ons a SPARCStation running OpenWindows 2.0.  Thanks!

On Unix systems you can obtain the file descriptor of the X connection.
You can then use the select system call (BSD interface) or the poll
system call (System V interface) to see if either the X connection or
your connection have data pending.  You can then modify your main
event driven loop to read from your socket when there is no activity
on the X connection.

			Chris Flatters

cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) (11/16/90)

>> I have an application which needs to read data off a socket.  I can 
>> arrange for it to be sent a ClientMessage when this data is to be
>> transmitted, but since the amount of data could be fairly large (though
>> I'm working to keep it of moderate size), I'd rather not have the
>> application simply sit there (vis a vis X) while reading data.  I'd
>> like to be able for it to respond to Expose events and the like while
>> still receiving data.  Is there a reasonable way to do this?  I'm using
>> just Xlib ons a SPARCStation running OpenWindows 2.0.  Thanks!
>
> On Unix systems you can obtain the file descriptor of the X connection.

I managed to leave out how you do this (the sort of that happens if
I post messages before drinking my morning coffee).  The macro
ConnectionNumber (display) will return the file descriptor.

			Chris Flatters