Thursday, July 30, 2015

python: reading fifo example

fifo - first-in first-out special file, named pipe

A FIFO special file (a named pipe) is similar to a pipe, except that
       it is accessed as part of the filesystem.  It can be opened by
       multiple processes for reading or writing.  When processes are
       exchanging data via the FIFO, the kernel passes all data internally
       without writing it to the filesystem.  Thus, the FIFO special file
       has no contents on the filesystem; the filesystem entry merely serves
       as a reference point so that processes can access the pipe using a
       name in the filesystem.


fifo reader code:


__author__ = "Ali Okan Yuksel <>"

import sys

def main():
        print "INFO application started"
        while True:
                line = fd.readline()
                if line !="":

if __name__=="__main__":

data sender bash call:

[root@logserver ~]# for i in `seq 1 1000`; do echo $i > /opt/proxy/okantest.fifo ; done

No comments:

Post a Comment