Have a Question?
Print

00195: How to bypass the I/O buffer when writing to a pipe

Title:

How to bypass the I/O buffer when writing to a pipe

Description:

Doing a pipe to C program (some times used for a Touch Screen device) and reading the values in BBx, it is waiting before it returns the values, acting like there is a buffer. Both the TIM and SIZ options on the READ do not make a difference. 

The problem has nothing to do with BBx and everything to do with the way pipes work, and the way the other program handled I/O. 

Most programs buffer their I/O, so if you open a bi-directional pipe, you can’t send something to the pipe and expect a response right away. This is not BBx’s choice–the other program can be generated so as to buffer or not buffer its I/O. If it buffers, it will only receive information in buffer-sized chunks, or after the write end of the pipe is closed. 

Resolution:

A useful trick is to use WRITE (channel,IND=0) to close the write end of the pipe. This is documented in the Installation and Configuration Guide. Once that happens, the other program will read any input it had buffered and respond to it. This also prevents any further writing to the pipe, so true query-and-response type interaction may not be possible, unless the other program can be made to perform unbuffered I/O. 



Last Modified: 02/10/2004 Product: PRO/5 Operating System: Unix

BASIS structures five components of their technology into the BBx Generations.

Table of Contents
Scroll to Top