Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How to clear named pipe to just have one line

by moritz (Cardinal)
on Feb 08, 2014 at 13:13 UTC ( #1073998=note: print w/ replies, xml ) Need Help??


in reply to How to clear named pipe to just have one line

I don't think it's possible; if you read from a (named) pipe, its content is gone. So you can't read to check how much is in there.

Usually you don't need it either, since named pipes are buffered, and once the buffer is full, writing to it blocks. And, more to the point, you shouldn't even care how much is in the pipe; pipes are there to abstract that away.

What problem are you actually trying to solve? It could be an XY Problem.


Comment on Re: How to clear named pipe to just have one line
Re^2: How to clear named pipe to just have one line
by techman2006 (Sexton) on Feb 08, 2014 at 13:22 UTC

    Basically there are two unrelated processes say P1 (A C program) and P2(a Perl script). Now P2 is running and is output some data to stdout. Now P1 will come at regular interval to read such data.

    As these are unrelated processes. So I was thinking to use named pipe. Now process P1 want to read only one line which is output from process P2. As it continuously generates output we want to truncate the data so that process P1 don't read redundant data.

    Any thoughts how to solve this problem.

        As process P1 is an server which is multithread and one of thread will try to read status from process P2. So process P1 will not have way to capture stdout of process P2.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1073998]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2014-08-20 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (124 votes), past polls