Re: XForms: Receiving data through pipe

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 19 Nov 97 06:32:08 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I tried to set up a program which does the following:
>
> 1. A callback routine of a button forks a childprocess which does some
> data acquistion throuh serial ports
>
> 2. An IO Callback function, registered to the main form, should receive
> data from the child process and display it.
>
> Until now, i did not manage to get the pipe communication with the
> IO-Callback working (even with the use of some piping examples in the
> Linux Programmers Guide). This should be a very common problem.

Sorry, but I don't have anything handy at the moment that isn't
hellaciously complicated but I do have some questions that may help
you resolve the problem.

What happens? Does the program hang? Core dump? Can you make a
version of the program work *without* XForms?

Basically, the I/O callback is not much more than a wrapper around the
select() system call. If you can get a stripped down version of your
program to work with select() then the I/O callback should be a
breeze.

For an excellent discussion of how to handle interprocess
communication through pipes and other methods, you might want to look
at _UNIX Network Programming_ by W. Richard Stevens, published by
Prentice Hall, ISBN 0-13-949876-1. He also has an excellent book
_Advanced Programming in the UNIX Environment_, published by
Addison-Wesley, ISBN 0-201-56317-7. Finally, there's the Old Standby,
_The UNIX Programming Environment_ by Brian Kernighan and Rob Pike
(Prentice-Hall, ISBN 0-13-937681-X).

spl

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/