[Nottingham] named pipes (fifo) help please

Cam camilo at mesias.co.uk
Wed Oct 26 17:30:12 BST 2005


Martin

> I want to use a named pipe to let a second process read at random times 
> the "latest results" from a first process...
> 
> What's the best/easiest way to avoid the first (writing) process 
> blocking on the pipe if the second process doesn't read for a long time?

Make sure the second process reads regularly,

> What I'm really after is just for the latest line of output to be picked 
> up by the second process without risking a partial read if I use a text 
> file for example instead of the pipe...

You can avoid partial reads by preceding each message with a length. 
Then the reader can always read a length, and having read the length it 
knows how much more to expect to read.

Hope that helps,

-Cam

-- 
camilo at mesias.co.uk                                                 <--



More information about the Nottingham mailing list